From 378159bba25efd66ea7a4f76b9b12cb3a038477e Mon Sep 17 00:00:00 2001 From: Jason Cox Date: Thu, 17 Sep 2020 18:06:26 -0700 Subject: [PATCH] Configure cache for static assets, HTML pages, and page-data (#606) --- nginx.conf | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/nginx.conf b/nginx.conf index 5703d21f1..51e673995 100644 --- a/nginx.conf +++ b/nginx.conf @@ -48,9 +48,24 @@ server { root /usr/share/nginx; location / { + expires 0; + add_header Cache-Control "public, must-revalidate"; try_files /htmlv2/$uri /html/$uri /htmlv2/$uri/index.html /html/$uri/index.html =404; } + location ^~ /static/ { + expires max; + add_header Cache-Control "public, immutable"; + try_files /htmlv2/$uri =404; + } + + location ^~ /page-data/ { + # page-data.json and app-data.json files shoud be revalidated on every request + expires 0; + add_header Cache-Control "public, must-revalidate"; + try_files /htmlv2/$uri /html/$uri =404; + } + location /robots.txt { alias /usr/share/nginx/html/robots/robots.txt; }