Merge pull request #5934 from lennondotw/fix/preserve-host-port

fix(proxy): preserve client ports in forwarded Host headers
This commit is contained in:
jc21 authored and GitHub committed 2026-11-05 10:15:05 +10:00
commit 18fc758b4f
7 files changed
+275 -3

No files matched your search

@@ -3,7 +3,7 @@ location ~* ^.*\.(css|js|jpe?g|gif|png|webp|woff|woff2|eot|ttf|svg|ico|css\.map|
# use the public cache
proxy_cache public-cache;
proxy_cache_key $host$request_uri;
proxy_cache_key $forward_host$request_uri;
# ignore these headers for media
proxy_ignore_headers Set-Cookie Cache-Control Expires X-Accel-Expires;
@@ -1,5 +1,5 @@
add_header X-Served-By $host;
proxy_set_header Host $host;
proxy_set_header Host $forward_host;
proxy_set_header X-Forwarded-Scheme $x_forwarded_scheme;
proxy_set_header X-Forwarded-Proto $x_forwarded_proto;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+6
View File
@@ -52,6 +52,12 @@ http {
# Dynamically generated resolvers file
include /etc/nginx/conf.d/include/resolvers[.]conf;
# Preserve the client authority, falling back when a request has no Host header.
map $http_host $forward_host {
default $http_host;
"" $host;
}
# Default upstream scheme
map $host $forward_scheme {
default http;