Fix: Disable aggressive caching for CSS/JS files
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
dvirlabs 2026-03-25 02:50:31 +02:00
parent dfb21aa0f8
commit f2e300bc2a

View File

@ -8,15 +8,26 @@ server {
gzip on; gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
# Main location # Main location - no cache for HTML
location / { location / {
try_files $uri $uri/ /index.html; try_files $uri $uri/ /index.html;
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
add_header Expires "0";
} }
# API proxy to backend service # No cache for CSS and JS to allow quick updates
# For Kubernetes: set BACKEND_HOST env var or use service name location ~* \.(css|js)$ {
# For Docker Compose: backend service name is 'backend' add_header Cache-Control "no-cache, no-store, must-revalidate";
location /api/ { add_header Pragma "no-cache";
add_header Expires "0";
}
# Cache images only
location ~* \.(jpg|jpeg|png|gif|ico|svg)$ {
expires 7d;
add_header Cache-Control "public, max-age=604800";
}
# In Kubernetes, this will be: oramap-backend:3000 # In Kubernetes, this will be: oramap-backend:3000
# In Docker Compose, this will be: backend:3000 # In Docker Compose, this will be: backend:3000
# Default to backend:3000 # Default to backend:3000
@ -36,9 +47,7 @@ server {
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $scheme;
} }
# Cache static assets # API proxy to backend service
location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg)$ { # For Kubernetes: set BACKEND_HOST env var or use service name
expires 1y; # For Docker Compose: backend service name is 'backend'
add_header Cache-Control "public, immutable"; location /api/ {
}
}