diff --git a/nginx.conf b/nginx.conf index ee0571d5e..703198e76 100644 --- a/nginx.conf +++ b/nginx.conf @@ -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;