Skip to content

Commit

Permalink
Avoid caching the root HTML pages (#37)
Browse files Browse the repository at this point in the history
* Avoid caching the root HTML pages

Avoid caching the / (index.html) and 50x.html pages

* Fix format

---------

Co-authored-by: Omar Selo <[email protected]>
  • Loading branch information
mz2 and omar-selo authored Aug 21, 2023
1 parent bad5e39 commit d07bc6a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions frontend/charm/src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ def nginx_config(self, base_uri: str) -> str:
index index.html index.htm;
try_files $uri $uri/ /index.html =404;
# Ensure no caching
expires -1;
add_header Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0";
sub_filter 'http://api-placeholder:30000/' '{base_uri}';
sub_filter_once on;
}}
Expand All @@ -132,6 +136,10 @@ def nginx_503_config(self) -> str:
location @maintenance {
rewrite ^(.*)$ /503.html break;
root /usr/share/nginx/html;
# Ensure no caching
expires -1;
add_header Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0";
}
}
"""
Expand Down

0 comments on commit d07bc6a

Please sign in to comment.