try with included in frontend location block

This commit is contained in:
einhornimmond 2025-05-21 16:38:26 +02:00
parent 688906a281
commit b48d47c5ee
2 changed files with 29 additions and 23 deletions

View File

@ -52,24 +52,27 @@ server {
rewrite ^/vue/?(.*)$ /$1 permanent;
}
# 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";
}
# hashed assets
location ~* \.(?:js|css|json)$ {
add_header Cache-Control "public, max-age=31536000, immutable";
}
# Frontend (default)
location / {
limit_req zone=frontend burst=150 nodelay;
limit_conn addr 60;
root $PROJECT_ROOT/frontend/build/;
index index.html;
try_files $uri $uri/ /index.html = 404;
# 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
add_header Cache-Control "no-cache, no-store, must-revalidate";

View File

@ -37,23 +37,26 @@ server {
rewrite ^/vue/?(.*)$ /$1 permanent;
}
# 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";
}
# hashed assets
location ~* \.(?:js|css|json)$ {
add_header Cache-Control "public, max-age=31536000, immutable";
}
# Frontend (default)
location / {
limit_req zone=frontend burst=150 nodelay;
limit_conn addr 60;
root $PROJECT_ROOT/frontend/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