From 59cdb341411dc0a1390cdb7e1df82d45d87165a0 Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Tue, 13 Jan 2026 17:12:17 -0500 Subject: [PATCH] fix: Remove redundant localhost proxy_redirects and add static location handling in nginx configuration --- aio/nginx.conf | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/aio/nginx.conf b/aio/nginx.conf index d05701dd..fe413193 100644 --- a/aio/nginx.conf +++ b/aio/nginx.conf @@ -53,7 +53,6 @@ http { add_header Access-Control-Allow-Origin "$http_origin" always; # Ensure redirects from Django include the external host:port proxy_redirect http://127.0.0.1/ $scheme://$http_host/; - proxy_redirect http://localhost/ $scheme://$http_host/; } location ^~ /docs { @@ -71,7 +70,6 @@ http { add_header Access-Control-Allow-Credentials "true" always; add_header Access-Control-Allow-Origin "$http_origin" always; proxy_redirect http://127.0.0.1/ $scheme://$http_host/; - proxy_redirect http://localhost/ $scheme://$http_host/; } location ^~ /accounts { @@ -89,7 +87,6 @@ http { add_header Access-Control-Allow-Credentials "true" always; add_header Access-Control-Allow-Origin "$http_origin" always; proxy_redirect http://127.0.0.1/ $scheme://$http_host/; - proxy_redirect http://localhost/ $scheme://$http_host/; } location ^~ /admin { @@ -119,7 +116,17 @@ http { proxy_set_header X-Forwarded-Host $http_host; proxy_set_header X-Forwarded-Port $server_port; proxy_redirect http://127.0.0.1/ $scheme://$http_host/; - proxy_redirect http://localhost/ $scheme://$http_host/; + } + + location ^~ /static { + proxy_pass http://django_upstream; + proxy_set_header Host $http_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Host $http_host; + proxy_set_header X-Forwarded-Port $server_port; + proxy_redirect http://127.0.0.1/ $scheme://$http_host/; } # Everything else to frontend (SvelteKit)