nginx: Relay the same Host: header that nginx saw.

Unilaterally adding the port can cause CSRF failures when the port is
a default port, and thus optional.  Switch to providing the exact
`Host` header that the original request contained.

(cherry picked from commit 5f783ed5ad)
This commit is contained in:
Alex Vandiver
2025-04-03 17:58:02 +00:00
committed by Tim Abbott
parent b7e38f4dd6
commit ab81867721

View File

@@ -2,7 +2,7 @@ proxy_http_version 1.1;
# Clearing the Connection header is required for keepalives from the load balancer
# http://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive
proxy_set_header Connection "";
proxy_set_header Host $host:$server_port;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $trusted_x_forwarded_proto;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-Ip $remote_addr;