FIX: repeat the proxy_set_header lines in the @discourse block
My previous understanding of this was incomplete: `proxy_set_header` only has an effect when proxy_pass is *directly* used. In our nginx configuration file, we have two paths to get from the `location /` main block to the upstream: 1: `location /` → `proxy_pass http://discourse` → `upstream discourse` 2: `location /` → `try_files @discourse` → `proxy_pass http://discourse` → `upstream discourse` In the first case, the `proxy_set_header` directives from the `location /` block (or one of its sub-blocks) takes effect and the headers are set as expected. In the second case, the `proxy_set_header` directives from the `location /` block are *not used* since `proxy_pass` was not used from that location. Only the `proxy_set_header` directives from the `location @discourse` block are considered since that is the configuration block that calls `proxy_pass`
This commit is contained in:
parent
e66df3a202
commit
db6e9def34
|
@ -261,6 +261,17 @@ server {
|
||||||
}
|
}
|
||||||
|
|
||||||
location @discourse {
|
location @discourse {
|
||||||
|
# fallback to discourse
|
||||||
|
#
|
||||||
|
# repeat the default proxy_set_header lines from above because we didn't
|
||||||
|
# get here via a proxy_pass statement
|
||||||
|
proxy_set_header Host $http_host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Request-Start "t=${msec}";
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $thescheme;
|
||||||
|
proxy_set_header X-Sendfile-Type "";
|
||||||
|
proxy_set_header X-Accel-Mapping "";
|
||||||
proxy_pass http://discourse;
|
proxy_pass http://discourse;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue