From 8b5d402d96b8630ffab439467117eaac389b7905 Mon Sep 17 00:00:00 2001 From: evanpelle Date: Wed, 12 Mar 2025 12:29:08 -0700 Subject: [PATCH] fix nginx.conf (#226) --- nginx.conf | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/nginx.conf b/nginx.conf index 3cda24140..b7d7d7551 100644 --- a/nginx.conf +++ b/nginx.conf @@ -196,20 +196,24 @@ server { proxy_set_header X-Forwarded-Proto $scheme; } - # Main location with conditional caching for index.html + # Location for index.html specifically + location ~* /index\.html$ { + proxy_pass http://127.0.0.1:3000; + add_header Cache-Control "public, max-age=1"; + proxy_cache STATIC; + proxy_cache_valid 200 302 1s; + proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504; + proxy_cache_lock on; + add_header X-Cache-Status $upstream_cache_status; + + proxy_set_header Host $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; + } + location / { proxy_pass http://127.0.0.1:3000; - - # Add caching for any index.html that might be served here - if ($request_uri ~* "index\.html$") { - add_header Cache-Control "public, max-age=1"; - proxy_cache STATIC; - proxy_cache_valid 200 302 1s; - proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504; - proxy_cache_lock on; - add_header X-Cache-Status $upstream_cache_status; - } - proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade;