Google App Engine Edge Cache not working

2019-06-22 15:11发布

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!

1条回答
女痞
2楼-- · 2019-06-22 16:07

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.

Console Logs

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.

查看更多
登录 后发表回答