Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 29 additions & 8 deletions services/frontend/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,45 @@ server {
root /usr/share/nginx/html;
index index.html;

location /assets/ {
try_files $uri =404;
access_log off;
add_header Cache-Control "public, max-age=31536000, immutable";
}
gzip on;
gzip_static on;
gzip_vary on;
gzip_min_length 256;
gzip_comp_level 6;
gzip_proxied any;
gzip_types
text/plain
text/css
text/javascript
application/javascript
application/json
application/xml
application/wasm
image/svg+xml
font/ttf
font/otf
font/woff
font/woff2;

location ~* \.(js|css|png|jpg|jpeg|gif|svg|ico|webp|txt|json|map)$ {
# Vite-built, content-hashed bundle output. Filename changes when bytes change,
# so we can hand out a one-year immutable cache. ^~ ensures this prefix wins
# over any regex location.
location ^~ /assets/ {
try_files $uri =404;
access_log off;
add_header Cache-Control "public, max-age=31536000, immutable";
add_header Cache-Control "public, max-age=31536000, immutable" always;
}

location = /healthz {
return 200 "ok";
add_header Content-Type text/plain;
}

# SPA entry document and unhashed root statics (favicon.png, banner.webp, ...).
# These have stable URLs but mutable content, so we force revalidation on every
# request. ETag/Last-Modified make 304s cheap.
location / {
add_header Cache-Control "no-cache" always;
try_files $uri /index.html;
}
}
}
9 changes: 8 additions & 1 deletion services/frontend/vite.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ import istanbul from 'vite-plugin-istanbul'

export default defineConfig({
build: {
target: "esnext"
target: "esnext",
rollupOptions: {
output: {
entryFileNames: 'assets/[hash].js',
chunkFileNames: 'assets/[hash].js',
assetFileNames: 'assets/[hash][extname]',
},
},
},
css: {
preprocessorOptions: {
Expand Down
Loading