From 6c507ad9cb15e7cf3f5f71e18bc5269378766db5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anger=20J=C3=A9r=C3=A9my?= Date: Wed, 6 Sep 2023 10:30:52 +0200 Subject: [PATCH] [nginx] replace $host by 127.0.0.1 this avoids doing DNS requests for nothing --- sysadmin/configs/nginx/default-docker | 25 ++++++++++------------ sysadmin/configs/nginx/default-integration | 20 ++++++++--------- sysadmin/configs/nginx/default-local | 20 ++++++++--------- sysadmin/configs/nginx/default-prod | 22 +++++++++---------- 4 files changed, 42 insertions(+), 45 deletions(-) diff --git a/sysadmin/configs/nginx/default-docker b/sysadmin/configs/nginx/default-docker index f1fbaeab..9ac37149 100644 --- a/sysadmin/configs/nginx/default-docker +++ b/sysadmin/configs/nginx/default-docker @@ -59,10 +59,7 @@ server { # DEMOS location /demo/ { - # If you want to see the value of a variable, the easiest way is - # adding a header like the example below - # add_header X-debug-message "$host" always; - proxy_pass http://$host:8080; + proxy_pass http://127.0.0.1:8080; } # CP @@ -70,7 +67,7 @@ server { add_header X-debug-message "$host" always; # If the distribution is Debian you need the resolver # resolver 127.0.0.1; - proxy_pass http://$host:8000; + proxy_pass http://127.0.0.1:8000; } location /cp2/static/ { @@ -87,7 +84,7 @@ server { proxy_pass http://cp2_socket; break; } - proxy_pass http://$host:8002; + proxy_pass http://127.0.0.1:8002; } # CORE @@ -95,16 +92,16 @@ server { rewrite ^/api/core/(.*) /$1 break; # If the distribution is Debian you need the resolver # resolver 127.0.0.1; - proxy_pass http://$host:8080; + proxy_pass http://127.0.0.1:8080; } location /api/dispatcher/ { - proxy_pass http://$host:8080; + proxy_pass http://127.0.0.1:8080; } location /api/conversion/ { - proxy_pass http://$host:8080; + proxy_pass http://127.0.0.1:8080; } location /api/demoinfo/ { - proxy_pass http://$host:8080; + proxy_pass http://127.0.0.1:8080; } # shared_folder, run static data @@ -120,7 +117,7 @@ server { rewrite ^/api/blobs/(.*) /$1 break; # If the distribution is Debian you need the resolver # resolver 127.0.0.1; - proxy_pass http://$host:9001; + proxy_pass http://127.0.0.1:9001; } # # BLOBS static data @@ -136,7 +133,7 @@ server { rewrite ^/api/archive/(.*) /$1 break; # If the distribution is Debian you need the resolver # resolver 127.0.0.1; - proxy_pass http://$host:9000; + proxy_pass http://127.0.0.1:9000; } # # ARCHIVE static data @@ -152,7 +149,7 @@ server { rewrite ^/api/demorunner/dr/(.*) /$1 break; # If the distribution is Debian you need the resolver # resolver 127.0.0.1; - proxy_pass http://$host:9004; + proxy_pass http://127.0.0.1:9004; proxy_buffering off; } @@ -160,6 +157,6 @@ server { return 301 /demo/; # If the distribution is Debian you need the resolver # resolver 127.0.0.1; - proxy_pass http://$host:8080; + proxy_pass http://127.0.0.1:8080; } } diff --git a/sysadmin/configs/nginx/default-integration b/sysadmin/configs/nginx/default-integration index 7eb0a4c4..8d88c97a 100644 --- a/sysadmin/configs/nginx/default-integration +++ b/sysadmin/configs/nginx/default-integration @@ -93,7 +93,7 @@ server { auth_basic "Restricted"; auth_basic_user_file /etc/nginx/.passwd/auth_test; resolver 127.0.0.1; - proxy_pass http://$host:81/$request_uri; + proxy_pass http://127.0.0.1:81/$request_uri; } location /auth_src/ { @@ -107,7 +107,7 @@ server { auth_basic "Restricted"; auth_basic_user_file /etc/nginx/.passwd/integration; resolver 127.0.0.1; - proxy_pass http://$host:8080; + proxy_pass http://127.0.0.1:8080; } # CP @@ -126,7 +126,7 @@ server { proxy_pass http://cp2_socket; break; } - proxy_pass http://$host:8002; + proxy_pass http://127.0.0.1:8002; } # Root @@ -140,16 +140,16 @@ server { location /api/core/{ rewrite ^/api/core/(.*) /$1 break; resolver 127.0.0.1; - proxy_pass http://$host:8080; + proxy_pass http://127.0.0.1:8080; } location /api/dispatcher/ { - proxy_pass http://$host:8080; + proxy_pass http://127.0.0.1:8080; } location /api/conversion/ { - proxy_pass http://$host:8080; + proxy_pass http://127.0.0.1:8080; } location /api/demoinfo/ { - proxy_pass http://$host:8080; + proxy_pass http://127.0.0.1:8080; } # shared_folder, serve static data @@ -164,7 +164,7 @@ server { location /api/blobs/ { rewrite ^/api/blobs/(.*) /$1 break; resolver 127.0.0.1; - proxy_pass http://$host:9001; + proxy_pass http://127.0.0.1:9001; } # BLOBS static data @@ -180,7 +180,7 @@ server { location /api/archive/ { rewrite ^/api/archive/(.*) /$1 break; resolver 127.0.0.1; - proxy_pass http://$host:9000; + proxy_pass http://127.0.0.1:9000; } # ARCHIVE static data @@ -195,7 +195,7 @@ server { location /api/demorunner/my-dr/ { rewrite ^/api/demorunner/dr_integration/(.*) /$1 break; resolver 127.0.0.1; - proxy_pass http://$host:9004; + proxy_pass http://127.0.0.1:9004; proxy_buffering off; } } diff --git a/sysadmin/configs/nginx/default-local b/sysadmin/configs/nginx/default-local index 5aa89889..7210715e 100644 --- a/sysadmin/configs/nginx/default-local +++ b/sysadmin/configs/nginx/default-local @@ -51,7 +51,7 @@ server { # adding a header like the example below # add_header X-debug-message "$host" always; add_header X-Frame-Options SAMEORIGIN always; - proxy_pass http://$host:8080; + proxy_pass http://127.0.0.1:8080; } # Root @@ -59,7 +59,7 @@ server { return 301 /demo/; # If the distribution is Debian you need the resolver # resolver 127.0.0.1; - proxy_pass http://$host:8080; + proxy_pass http://127.0.0.1:8080; } location /cp2/static/ { @@ -77,7 +77,7 @@ server { proxy_pass http://cp2_socket; break; } - proxy_pass http://$host:8002; + proxy_pass http://127.0.0.1:8002; } # CORE @@ -85,16 +85,16 @@ server { rewrite ^/api/core/(.*) /$1 break; # If the distribution is Debian you need the resolver # resolver 127.0.0.1; - proxy_pass http://$host:8080; + proxy_pass http://127.0.0.1:8080; } location /api/dispatcher/ { - proxy_pass http://$host:8080; + proxy_pass http://127.0.0.1:8080; } location /api/conversion/ { - proxy_pass http://$host:8080; + proxy_pass http://127.0.0.1:8080; } location /api/demoinfo/ { - proxy_pass http://$host:8080; + proxy_pass http://127.0.0.1:8080; } # shared_folder, serve static data @@ -110,7 +110,7 @@ server { rewrite ^/api/blobs/(.*) /$1 break; # If the distribution is Debian you need the resolver # resolver 127.0.0.1; - proxy_pass http://$host:9001; + proxy_pass http://127.0.0.1:9001; } # # BLOBS static data @@ -126,7 +126,7 @@ server { rewrite ^/api/archive/(.*) /$1 break; # If the distribution is Debian you need the resolver # resolver 127.0.0.1; - proxy_pass http://$host:9000; + proxy_pass http://127.0.0.1:9000; } # # ARCHIVE static data @@ -142,7 +142,7 @@ server { rewrite ^/api/demorunner/my-dr/(.*) /$1 break; # If the distribution is Debian you need the resolver # resolver 127.0.0.1; - proxy_pass http://$host:9004; + proxy_pass http://127.0.0.1:9004; proxy_buffering off; } } diff --git a/sysadmin/configs/nginx/default-prod b/sysadmin/configs/nginx/default-prod index f14de5d7..ef51da71 100644 --- a/sysadmin/configs/nginx/default-prod +++ b/sysadmin/configs/nginx/default-prod @@ -123,29 +123,29 @@ server { location @CompanyNamePasswd { auth_basic "Restricted"; auth_basic_user_file /etc/nginx/.passwd/CompanyName; - proxy_pass http://$host:8080; + proxy_pass http://127.0.0.1:8080; } # DEMO INDEX FROM CORE location /demo/ { resolver 127.0.0.1; - proxy_pass http://$host:8080; + proxy_pass http://127.0.0.1:8080; } # CORE location /api/core/{ rewrite ^/api/core/(.*) /$1 break; resolver 127.0.0.1; - proxy_pass http://$host:8080; + proxy_pass http://127.0.0.1:8080; } location /api/dispatcher/ { - proxy_pass http://$host:8080; + proxy_pass http://127.0.0.1:8080; } location /api/conversion/ { - proxy_pass http://$host:8080; + proxy_pass http://127.0.0.1:8080; } location /api/demoinfo/ { - proxy_pass http://$host:8080; + proxy_pass http://127.0.0.1:8080; } # shared_folder, serve static data @@ -160,7 +160,7 @@ server { location /api/blobs/ { rewrite ^/api/blobs/(.*) /$1 break; resolver 127.0.0.1; - proxy_pass http://$host:9001; + proxy_pass http://127.0.0.1:9001; } # # BLOBS static data @@ -175,7 +175,7 @@ server { location /api/archive/ { rewrite ^/api/archive/(.*) /$1 break; resolver 127.0.0.1; - proxy_pass http://$host:9000; + proxy_pass http://127.0.0.1:9000; } # # ARCHIVE static data @@ -190,14 +190,14 @@ server { location ~ /api/demorunner/my-dr/ { rewrite ^/api/demorunner/my-dr/(.*) /$1 break; resolver 127.0.0.1; - proxy_pass http://$host:9004; + proxy_pass http://127.0.0.1:9004; proxy_buffering off; } # Root location / { return 301 /demo/; - proxy_pass http://ipolcore.ipol.im:8080; + proxy_pass http://127.0.0.1:8080; } location /cp2/static/ { @@ -213,6 +213,6 @@ server { proxy_pass http://cp2_socket; break; } - proxy_pass http://$host:8002; + proxy_pass http://127.0.0.1:8002; } }