# Variables used by conf.d/include/proxy.conf, conf.d/include/assets.conf and the # generated host configs. nginx.conf includes this file just before the custom # http_top.conf, so maps there can redefine these variables. For an nginx.conf kept # from an older release, which has no such include, the startup script loads it # through conf.d/*.conf instead (prepare/40-dynamic.sh). # Forwarded Host: nginx's normalised $host (lowercased, taken from the request line for # absolute-form requests) plus the client's port, so upstreams that compare Host with # Origin/Referer on non-standard ports keep working. The port is only carried over when # the Host header names the same host nginx routed on; otherwise (no Host, absolute-form # URI naming a different host) it falls back to bare $host. Using $host rather than the # raw header keeps case variants and mismatched Host values out of upstream requests and # the asset cache key. map "$host|$http_host" $forward_host { "~*^(?[^|]+)\|\k(?:[0-9]+)$" "$host$fwd_port"; default $host; } # Default upstream scheme map $host $forward_scheme { default http; } # Handle upstream X-Forwarded-Proto and X-Forwarded-Scheme header map $http_x_forwarded_proto $x_forwarded_proto { "http" "http"; "https" "https"; default $scheme; } map $http_x_forwarded_scheme $x_forwarded_scheme { "http" "http"; "https" "https"; default $scheme; }