In my GAE app I am serving static content as follows (those are my entries in my app.yaml file):
handlers:
- url: /css
static_dir: static/css
expiration: "10m"
- url: /js
static_dir: static/js
expiration: "10m"
Despite the information available here: https://developers.google.com/appengine/docs/python/config/appconfig#expiration the content is never cached in the browser regardless whether I use the dev server or upload my app.
I am using Chrome and the request header is:
cache-control:max-age=0
and the response headers are:
cache-control:no-cache, must-revalidate
pragma:no-cache
server:Google Frontend
status:304 Not Modified
As per some answers I was able to find, I tested this both with being logged in and out into my google admin account and nothing changes.
Any help on this would be greatly appreciated. Many thanks!
Response headers I get when logged out of my admin account:
date:Fri, 25 Apr 2014 09:54:44 GMT
etag:"lhoIow"
server:Google Frontend
status:304 Not Modified
version:HTTP/1.1
GAE should work fine with
10m
value. Most probably that was because you were signed in with your google admin account. GAE returnsno-cache
for such accounts. Trying opening the same page in an incognito returns proper cache expiry times.By default GAE sets cache to 10 minutes, so even if you didn't set any expiry - you should see 10 minutes instead of no-cache.
After the hint from Martijn above I changed expiration values in my app.yaml to:
Now everything works as expected and the I get the following headers in response:
Everything seems to work as expected now.