cache admin also

This commit is contained in:
einhornimmond 2025-05-21 16:42:46 +02:00
parent b48d47c5ee
commit 7ca419b320
2 changed files with 29 additions and 1 deletions

View File

@ -136,6 +136,20 @@ server {
rewrite ^/admin/(.*)$ /$1 break;
root $PROJECT_ROOT/admin/build/;
index index.html;
# caching rules for assets
# static assets
location ~* \.(?:woff2?|ttf|otf|eot|jpg|jpeg|png|gif|svg|webp|ico)$ {
# keep assets for a week
add_header Cache-Control "public, max-age=604800";
try_files $uri =404;
}
# hashed assets
location ~* \.(?:js|css|json)$ {
add_header Cache-Control "public, max-age=31536000, immutable";
try_files $uri =404;
}
try_files $uri $uri/ /index.html = 404;
# don't cache index.html

View File

@ -56,7 +56,7 @@ server {
add_header Cache-Control "public, max-age=31536000, immutable";
try_files $uri =404;
}
try_files $uri $uri/ /index.html = 404;
# don't cache index.html
@ -121,6 +121,20 @@ server {
rewrite ^/admin/(.*)$ /$1 break;
root $PROJECT_ROOT/admin/build/;
index index.html;
# caching rules for assets
# static assets
location ~* \.(?:woff2?|ttf|otf|eot|jpg|jpeg|png|gif|svg|webp|ico)$ {
# keep assets for a week
add_header Cache-Control "public, max-age=604800";
try_files $uri =404;
}
# hashed assets
location ~* \.(?:js|css|json)$ {
add_header Cache-Control "public, max-age=31536000, immutable";
try_files $uri =404;
}
try_files $uri $uri/ /index.html = 404;
# don't cache index.html