【发布时间】:2012-10-09 06:43:38
【问题描述】:
我在通过 HTTPS 提供 appengine blobstore 时遇到问题,特别是在 IE 8 和 IE 7 浏览器中,因为浏览器不喜欢通过 https 提供可下载的内容。 根据微软的一篇文章,这是因为 Cache-Control: no-cache 标头。
文章中提出的解决方案是从响应中移除 Cache-Control: no-cache 标头。 但是,即使我尝试将其设置为其他内容,webapp2 似乎也会自动添加此标头。
从源码看,好像是每个响应都加了 http://code.google.com/p/webapp-improved/source/browse/webapp2.py#362
def __init__(self, *args, **kwargs):
"""Constructs a response with the default settings."""
super(Response, self).__init__(*args, **kwargs)
self.headers['Cache-Control'] = 'no-cache'
有没有办法覆盖这种行为?
这是我在构建响应时尝试做的事情,但是一旦呈现响应,'Cache-Control: no-cache' 仍然存在。
self.response.headers['Pragma'] = 'cache-control'
self.response.headers['Cache-Control'] = 'private'
self.response.cache_control.no_cache = None
self.response.cache_control.public = False
self.response.cache_control.max_age = 1
【问题讨论】:
标签: python google-app-engine internet-explorer-8 blobstore webapp2