still allow nginx to cache root for 1 second

This commit is contained in:
Evan
2025-03-18 10:12:42 -07:00
parent 3a4db82c9a
commit 7b41268cc9
+9 -5
View File
@@ -175,17 +175,21 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# Root location with no caching
# Root location with short Nginx cache but no browser cache
location = / {
proxy_pass http://127.0.0.1:3000;
# Tell browsers not to cache
add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate";
add_header Pragma "no-cache";
add_header Expires "0";
# Disable proxy cache for index.html
proxy_no_cache 1;
proxy_cache_bypass 1;
# But let Nginx cache for 1 second to reduce load
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;
# Show cache status in response headers
add_header X-Cache-Status $upstream_cache_status;