nginx-kit/proxy_pass/forwarded.conf
2026-06-09 14:41:15 +08:00

24 lines
1 KiB
Text

# Preserve the original Host header, including a non-default port, because many
# upstream frameworks use it when generating absolute URLs.
proxy_set_header Host $http_host;
# Keep the de-facto standard X-Forwarded-* headers and the older Scheme header
# together. Some upstreams still read Scheme while newer ones prefer
# X-Forwarded-Proto.
proxy_set_header Scheme $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
# Preserve WebDAV and object-storage style Destination requests when proxying.
proxy_set_header Destination $http_destination;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# Leave this legacy hint in place because some older applications and middleware
# still branch on it when they know they are behind nginx.
proxy_set_header X-NginX-Proxy true;
# Avoid rewriting Location headers implicitly. Callers can add explicit
# proxy_redirect rules locally if an upstream really needs them.
proxy_redirect off;