server { listen 80; server_name localhost; gzip_static on; root /usr/share/nginx/html; # Only cache files in /console/_app/immutable/ for 1 year location /console/_app/immutable/ { try_files $uri =404; expires 1y; add_header Pragma public; add_header Cache-Control "public"; } # Cache, but revalidate, for images, css, fonts, and icons folders location ~* ^/console/(images|css|fonts|icons)/ { expires 1d; add_header Cache-Control "public, must-revalidate"; } # All other /console requests (no cache) location /console { index index.html index.html; try_files $uri /console/index.html; expires 0; add_header Cache-Control "no-cache, no-store"; add_header Pragma "no-cache"; # Security headers add_header X-UA-Compatible "IE=Edge"; add_header X-Frame-Options SAMEORIGIN; add_header X-XSS-Protection "1; mode=block;"; add_header X-Content-Type-Options nosniff; } location / { absolute_redirect off; return 301 /console; } }