oramap/frontend/nginx.conf
dvirlabs f2e300bc2a
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Fix: Disable aggressive caching for CSS/JS files
2026-03-25 02:50:31 +02:00

54 lines
1.8 KiB
Nginx Configuration File

server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# Gzip compression
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
# Main location - no cache for HTML
location / {
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";
}
# No cache for CSS and JS to allow quick updates
location ~* \.(css|js)$ {
add_header Cache-Control "no-cache, no-store, must-revalidate";
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 Docker Compose, this will be: backend:3000
# Default to backend:3000
set $backend_host backend;
if ($http_x_backend_host != "") {
set $backend_host $http_x_backend_host;
}
proxy_pass http://$backend_host:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
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;
}
# API proxy to backend service
# For Kubernetes: set BACKEND_HOST env var or use service name
# For Docker Compose: backend service name is 'backend'
location /api/ {