Precompress assets and set the right cache headers

This commit is contained in:
Quentin Gliech
2024-11-15 00:53:07 +01:00
parent 50934a53cd
commit f022eb09a2
5 changed files with 26 additions and 18 deletions

View File

@@ -3,23 +3,16 @@ server {
server_name localhost;
root /app;
gzip_static on;
location / {
# disable cache entriely by default (apart from Etag which is accurate enough)
add_header Cache-Control 'private no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
if_modified_since off;
expires off;
# also turn off last-modified since they are just the timestamps of the file in the docker image
# and may or may not bear any resemblance to when the resource changed
add_header Last-Modified "";
try_files $uri $uri/ /index.html;
add_header Cache-Control "no-store, no-cache, must-revalidate";
}
# assets can be cached because they have hashed filenames
location /assets {
expires 1w;
add_header Cache-Control "public, no-transform";
add_header Cache-Control "public, immutable, max-age=31536000";
}
location /apple-app-site-association {