From aabb783d99db8885e1d76376eabcef4052b79d76 Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Sun, 14 Mar 2021 11:58:57 +0200 Subject: [PATCH] app.yaml: Set Cache-Control header to private for CSS Google App Engine agressively caches stuff. They are currently serving a 24-hour old version of my CSS after multiple updates and re-deploys. Ughhh. From their docs: > After a file is transmitted with a given expiration time, there is > generally no way to clear it out of web-proxy caches, even if the user > clears their own browser cache. Re-deploying a new version of the app > will not reset any caches. Therefore, if you ever plan to modify a > static file, it should have a short (less than one hour) expiration > time. In most cases, the default 10-minute expiration time is > appropriate. The only way to break this for now is to change the CSS *directory*. In the future I think we have to be sure to set the private cache control header, which lets browsers cache it, but not public CDNs. See: https://cloud.google.com/appengine/docs/standard/python3/how-requests-are-handled --- app.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app.yaml b/app.yaml index 78904c3..1b1d033 100644 --- a/app.yaml +++ b/app.yaml @@ -4,3 +4,5 @@ entrypoint: gunicorn -b :$PORT main:app handlers: - url: /static/css static_dir: static/css + http_headers: + Cache-Control: private