From b9cc1d1b099928c8ecc0bcb70a610093d5aa1864 Mon Sep 17 00:00:00 2001 From: Syogo-Suganoya <55225064+Syogo-Suganoya@users.noreply.github.com> Date: Tue, 1 Dec 2026 06:03:46 +0900 Subject: [PATCH] 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. --- contrib/container/nginx.conf | 3 +++ contrib/packager.io/nginx.prod.conf | 3 +++ 2 files changed, 6 insertions(+) diff --git a/contrib/container/nginx.conf b/contrib/container/nginx.conf index 91b82adae1..e1562ec9ec 100644 --- a/contrib/container/nginx.conf +++ b/contrib/container/nginx.conf @@ -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; } } diff --git a/contrib/packager.io/nginx.prod.conf b/contrib/packager.io/nginx.prod.conf index a78b9ebd0f..58eca75d79 100644 --- a/contrib/packager.io/nginx.prod.conf +++ b/contrib/packager.io/nginx.prod.conf @@ -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; } }