Forward the host header in nginx auth requests (#13417)

The /auth subrequest used to check access to media files did not set
the Host header, so it reached the server as the upstream address
(e.g. inventree-server:8000 or localhost:6000). When that address is
not in ALLOWED_HOSTS, the server rejects the request with a 400 error,
which nginx returns as a 500 error for every media file.
This commit is contained in:
Syogo-Suganoya authored and GitHub committed 2026-12-01 08:03:46 +11:00
1 parent 28f914e088
commit b9cc1d1b09
2 files changed
+6

No files matched your search

+3
View File
@@ -65,6 +65,9 @@ server {
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Original-URI $request_uri;
# Forward the original host header, so that it matches ALLOWED_HOSTS
proxy_set_header Host $http_host;
}
}
+3
View File
@@ -62,6 +62,9 @@ server {
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Original-URI $request_uri;
# Forward the original host header, so that it matches ALLOWED_HOSTS
proxy_set_header Host $http_host;
}
}