fix: Remove redundant localhost proxy_redirects and add static location handling in nginx configuration

This commit is contained in:
Sean Morley
2026-01-13 17:12:17 -05:00
parent 1950f72805
commit 59cdb34141

View File

@@ -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)