Skip to content

Commit

Permalink
Configure cache for static assets, HTML pages, and page-data (#606)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonbcox authored Sep 18, 2020
1 parent 1d3e2d2 commit 378159b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 378159b

Please sign in to comment.