mirror of
https://github.com/discourse/discourse.git
synced 2025-06-25 01:30:17 +08:00

This commit reverts commit b600288 "FIX: Simplify nginx config change (#30383)" and fixes it by repeating the `proxy_set_header` lines in the `@discourse` block. Our 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`