From a8b544006e34672e62cf1d49e0f77de38300f8ec Mon Sep 17 00:00:00 2001 From: Chris Pymm Date: Thu, 28 Nov 2024 17:50:17 +0000 Subject: [PATCH] build(cache): attempt to fix caching headers --- docker/nginx-staging.conf | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/docker/nginx-staging.conf b/docker/nginx-staging.conf index e885fcf0..20140773 100644 --- a/docker/nginx-staging.conf +++ b/docker/nginx-staging.conf @@ -8,14 +8,6 @@ server { gzip_comp_level 5; gzip_types text/plain text/html text/css application/json application/javascript application/x-javascript text/javascript text/xml application/xml; - location / { - root /usr/share/nginx/html; - index index.html index.htm; - - auth_basic "Staging site"; - auth_basic_user_file /etc/nginx/.htpasswd; - } - location ~* \.(html)$ { etag off; if_modified_since off; @@ -23,9 +15,19 @@ server { } location ~* \.(ico|jpg|jpeg|png|js|css|woff|woff2)$ { + etag off; + if_modified_since off; add_header Cache-Control "public max-age=31536000 immutable" } + location / { + root /usr/share/nginx/html; + index index.html index.htm; + + auth_basic "Staging site"; + auth_basic_user_file /etc/nginx/.htpasswd; + } + error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html;