Files
nginx-proxy-manager/docker/rootfs/etc/nginx/conf.d/include/proxy-variables.conf
T
Jamie Curnow 144de80d40 Move proxy variables into their own file
And include them in base nginx.conf. No-one should be bind mounting
nginx.conf but if they are, they can include that file now too.
2026-11-16 21:34:48 +10:00

35 lines
1.4 KiB
Plaintext

# 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 {
"~*^(?<fwd_name>[^|]+)\|\k<fwd_name>(?<fwd_port>:[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;
}