Google App Engine Edge Cache无法正常工作 [英] Google App Engine Edge Cache not working

查看:114
本文介绍了Google App Engine Edge Cache无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基于以下文章,我设置了google appengine边缘缓存。
http://www.xyhd.tv/2011/11/industry-news/setting-cache-control-headers-in-python-to-take-advantage-of-google- appengines-edgecache /



直到最近它才完美。我注意到它不再工作
(所有的请求中日志的状态代码变成了200而不是204)
有没有办法解决它?



< h1> UPDATE(2015/7/20)

该错误已修复! NICE!

解决方案

我测试了一条使用边缘缓存的路由,它在日志中显示204状态。
$ b

  response.headers ['Pragma'] ='公开'
response.headers ['Cache-Control'] ='public,max-age =%d'%time

在边缘缓存开始之前,它通常需要重复几次。



时间值需要至少61秒。我通常将其设置为至少120,并且工作得很好。



我不认为该文章提到的一件事是应用程序需要开启结算功能这个工作。



更新:
我上传了您引用的代码,并获得了缓存url上的204响应状态。在下面的屏幕截图中,您会看到第一个命中是200状态,然后是边缘缓存加入的204秒。无缓存url每次返回200秒。





更新(7 / 20/2015): b
$ b

现在,从自定义域名或APP_ID.appspot.com调用应用引擎应用时,边缘缓存似乎正在工作。我现在在日志中看到204响应代码。没有更改任何代码。


I setup the google appengine edge cache before based on the following article. http://www.xyhd.tv/2011/11/industry-news/setting-cache-control-headers-in-python-to-take-advantage-of-google-appengines-edgecache/

It works perfect until recently. I notice it didn't work anymore (all requests status code in logs becomes 200 instead of 204) Is there a way to fix it?

UPDATE (2015/7/20)

The bug has been fixed! NICE!

解决方案

I tested one of my routes that uses edge cache and it does show 204 status in the logs. Be sure to include both headers in your response.

response.headers['Pragma'] = 'Public'
response.headers['Cache-Control'] = 'public, max-age=%d'%time

It generally takes a few hits back to back before the edge caching starts.

The time value needs to be a minimum of 61 seconds. I generally set that to at least 120 and it's been working great.

One thing I don't think that article mentions is that the app needs to have billing turned on for this to work.

Update: I uploaded the code you referenced and am getting the 204 response status on the cached url. In the screenshot below, you will see the first hit was 200 status, then 204s where edge cache kicked in. The no-cache url returns 200s every time as expected.

Update (7/20/2015):

Edge cache now appears to be working when calling app engine app from either custom domain or APP_ID.appspot.com. I see 204 response code in the logs now for both. Didn't change any code.

这篇关于Google App Engine Edge Cache无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆