fix: Extend Forwarded header, if present (#25827)
This is to fix OAuth redirect URI not being computed correctly, when deployed to CloudRun. More details at http://sharats.me/drafts/story-of-a-forwarded-header.html.
This commit is contained in:
parent
71268ca31b
commit
50a18c325f
|
|
@ -19,6 +19,11 @@ map \$http_x_forwarded_host \$origin_host {
|
||||||
'' \$host;
|
'' \$host;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
map \$http_forwarded \$final_forwarded {
|
||||||
|
default '\$http_forwarded, host=\$host;proto=\$scheme';
|
||||||
|
'' '';
|
||||||
|
}
|
||||||
|
|
||||||
# redirect log to stdout for supervisor to capture
|
# redirect log to stdout for supervisor to capture
|
||||||
access_log /dev/stdout;
|
access_log /dev/stdout;
|
||||||
|
|
||||||
|
|
@ -67,7 +72,8 @@ server {
|
||||||
}
|
}
|
||||||
|
|
||||||
proxy_set_header X-Forwarded-Proto \$origin_scheme;
|
proxy_set_header X-Forwarded-Proto \$origin_scheme;
|
||||||
proxy_set_header X-Forwarded-Host \$origin_host;
|
proxy_set_header X-Forwarded-Host \$origin_host;
|
||||||
|
proxy_set_header Forwarded \$final_forwarded;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
try_files /loading.html \$uri /index.html =404;
|
try_files /loading.html \$uri /index.html =404;
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,11 @@ map \$http_x_forwarded_host \$origin_host {
|
||||||
'' \$host;
|
'' \$host;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
map \$http_forwarded \$final_forwarded {
|
||||||
|
default '\$http_forwarded, host=\$host;proto=\$scheme';
|
||||||
|
'' '';
|
||||||
|
}
|
||||||
|
|
||||||
# redirect log to stdout for supervisor to capture
|
# redirect log to stdout for supervisor to capture
|
||||||
access_log /dev/stdout;
|
access_log /dev/stdout;
|
||||||
|
|
||||||
|
|
@ -70,6 +75,7 @@ server {
|
||||||
|
|
||||||
proxy_set_header X-Forwarded-Proto \$origin_scheme;
|
proxy_set_header X-Forwarded-Proto \$origin_scheme;
|
||||||
proxy_set_header X-Forwarded-Host \$origin_host;
|
proxy_set_header X-Forwarded-Host \$origin_host;
|
||||||
|
proxy_set_header Forwarded \$final_forwarded;
|
||||||
|
|
||||||
client_max_body_size 150m;
|
client_max_body_size 150m;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user