diff --git a/frontend/nginx.conf.tmpl b/frontend/nginx.conf.tmpl index a3dfd3c0a..459501472 100644 --- a/frontend/nginx.conf.tmpl +++ b/frontend/nginx.conf.tmpl @@ -6,11 +6,32 @@ server { root /usr/share/nginx/html; index index.html; try_files $uri ${SUBROUTE}/index.html; + + # Ensure that non-versioned resources are checked + # with upstream before using the cached version. + add_header Cache-Control 'no-cache must-revalidate'; + expires 0; + } + + location ~ ${SUBROUTE}/favicon.* { + root /usr/share/nginx/html; + + # Allow favicons to be cached, although for shorter periods. + add_header Cache-Control 'public'; + expires 1M; + } + + location ${SUBROUTE}/static { + root /usr/share/nginx/html; + + # Allow versioned resources to be cached freely, since a modification + # would also change the file name (i.e. they are immutable). + add_header Cache-Control 'immutable'; + expires 1y; } location /healthz { access_log off; return 200 "healthy\n"; } - }