From d07bc6ab171331aac0ec5a7ec4213bc63978330f Mon Sep 17 00:00:00 2001 From: Matias Piipari Date: Mon, 21 Aug 2023 14:27:38 +0300 Subject: [PATCH] Avoid caching the root HTML pages (#37) * Avoid caching the root HTML pages Avoid caching the / (index.html) and 50x.html pages * Fix format --------- Co-authored-by: Omar Selo --- frontend/charm/src/charm.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/frontend/charm/src/charm.py b/frontend/charm/src/charm.py index d3f2451d..8e8348ac 100755 --- a/frontend/charm/src/charm.py +++ b/frontend/charm/src/charm.py @@ -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; }} @@ -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"; } } """