1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
# It's common to forward the Host header to the backend.
proxy_set_header Host $host;
# It's also common to set X-Real-IP with the $remote_addr of the connection.
proxy_set_header X-Real-IP $remote_addr;
# X-Forwarded-{For,Proto,Host,Port} are typically proxied for reverse-proxy components
# to backends that support X-Forwarded-For parsing.
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
# X-Forwarded-For is around AND still supported, but Forwarded is also an option
# It's not natively generated in NGINX, and not all backends support it,
# but it is a standard that is an alternative to X-Forwarded-*
proxy_set_header Forwarded "by=hidden;for=$remote_addr;host=$host;proto=$scheme";
# Upgrade, Connection, and HTTP/1.1 are usually for websockets, which are becoming
# quite common.
proxy_set_header Upgrade $http_upgrade;
# Note: $req_connection is defined in conf.d/http-upgrade_req-connection_map.conf
proxy_set_header Connection $req_connection;
proxy_http_version 1.1;
|