Fix X-Forwarded-Host with multiple rev-proxies (#16951)
This commit is contained in:
parent
282f1ff5a6
commit
d6b4cb5f19
|
|
@ -13,6 +13,12 @@ map \$http_x_forwarded_proto \$origin_scheme {
|
||||||
default \$http_x_forwarded_proto;
|
default \$http_x_forwarded_proto;
|
||||||
'' \$scheme;
|
'' \$scheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
map \$http_x_forwarded_host \$origin_host {
|
||||||
|
default \$http_x_forwarded_host;
|
||||||
|
'' \$host;
|
||||||
|
}
|
||||||
|
|
||||||
# redirect log to stdout for supervisor to capture
|
# redirect log to stdout for supervisor to capture
|
||||||
access_log /dev/stdout;
|
access_log /dev/stdout;
|
||||||
|
|
||||||
|
|
@ -50,8 +56,8 @@ server {
|
||||||
|
|
||||||
proxy_set_header Host \$http_host/supervisor/;
|
proxy_set_header Host \$http_host/supervisor/;
|
||||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||||
proxy_set_header X-Forwarded-Proto \$scheme;
|
proxy_set_header X-Forwarded-Proto \$origin_scheme;
|
||||||
proxy_set_header X-Forwarded-Host \$http_host;
|
proxy_set_header X-Forwarded-Host \$origin_host;
|
||||||
proxy_set_header Connection "";
|
proxy_set_header Connection "";
|
||||||
|
|
||||||
proxy_pass http://localhost:9001/;
|
proxy_pass http://localhost:9001/;
|
||||||
|
|
@ -61,7 +67,7 @@ server {
|
||||||
}
|
}
|
||||||
|
|
||||||
proxy_set_header X-Forwarded-Proto \$origin_scheme;
|
proxy_set_header X-Forwarded-Proto \$origin_scheme;
|
||||||
proxy_set_header X-Forwarded-Host \$host;
|
proxy_set_header X-Forwarded-Host \$origin_host;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
try_files \$uri /index.html =404;
|
try_files \$uri /index.html =404;
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,12 @@ map \$http_x_forwarded_proto \$origin_scheme {
|
||||||
default \$http_x_forwarded_proto;
|
default \$http_x_forwarded_proto;
|
||||||
'' \$scheme;
|
'' \$scheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
map \$http_x_forwarded_host \$origin_host {
|
||||||
|
default \$http_x_forwarded_host;
|
||||||
|
'' \$host;
|
||||||
|
}
|
||||||
|
|
||||||
# redirect log to stdout for supervisor to capture
|
# redirect log to stdout for supervisor to capture
|
||||||
access_log /dev/stdout;
|
access_log /dev/stdout;
|
||||||
|
|
||||||
|
|
@ -55,7 +61,7 @@ server {
|
||||||
proxy_set_header X-Real-IP \$remote_addr;
|
proxy_set_header X-Real-IP \$remote_addr;
|
||||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||||
proxy_set_header X-Forwarded-Proto \$origin_scheme;
|
proxy_set_header X-Forwarded-Proto \$origin_scheme;
|
||||||
proxy_set_header X-Forwarded-Host \$http_host;
|
proxy_set_header X-Forwarded-Host \$origin_host;
|
||||||
proxy_set_header Connection "";
|
proxy_set_header Connection "";
|
||||||
proxy_pass http://localhost:9001/;
|
proxy_pass http://localhost:9001/;
|
||||||
auth_basic "Protected";
|
auth_basic "Protected";
|
||||||
|
|
@ -63,7 +69,7 @@ server {
|
||||||
}
|
}
|
||||||
|
|
||||||
proxy_set_header X-Forwarded-Proto \$origin_scheme;
|
proxy_set_header X-Forwarded-Proto \$origin_scheme;
|
||||||
proxy_set_header X-Forwarded-Host \$host;
|
proxy_set_header X-Forwarded-Host \$origin_host;
|
||||||
|
|
||||||
client_max_body_size 100m;
|
client_max_body_size 100m;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user