无法在app.yaml中为python应用程序设置缓存过期 [英] unable to set cache expiration on in app.yaml for a python app
问题描述
在我的GAE应用程序中,我提供的静态内容如下(这些是我的app.yaml文件中的条目):
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"
请点击此处: https://developers.google.com/appengine/docs/ python / config / appconfig#expiration 内容永远不会缓存在浏览器中,无论我使用的是开发服务器还是上传我的应用程序。
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.
我使用的是Chrome,请求标题是:
$ b
I am using Chrome and the request header is:
cache-control:max-age=0
和响应标题是:
$ b
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
推荐答案
使用 10m
值正常工作。
很可能是因为您使用您的Google管理员帐户登录的。
GAE会为这些帐户返回 no-cache
。
尝试在隐身模式下打开相同页面会返回适当的缓存过期时间。
GAE should work fine with 10m
value.
Most probably that was because you were signed in with your google admin account.
GAE returns no-cache
for such accounts.
Trying opening the same page in an incognito returns proper cache expiry times.
默认情况下GAE会将缓存设置为10分钟,因此即使您没有设置任何到期 - 您应该看到10分钟而不是无缓存。
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.
这篇关于无法在app.yaml中为python应用程序设置缓存过期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!