Add cache headers for console static assets

Configure 1-day caching with revalidation for images, CSS, fonts,
and icons in the /console path to improve performance while ensuring
freshness.
This commit is contained in:
Torsten Dittmann
2025-05-27 15:47:41 +02:00
parent 1ca27a6244
commit 42ce877cb8
+7 -2
View File
@@ -4,7 +4,6 @@ server {
gzip_static on;
# Set root for all locations
root /usr/share/nginx/html;
# Security headers for all locations
@@ -22,11 +21,17 @@ server {
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-store";
add_header Pragma "no-cache";