使用NGINX和Gunicorn保存来自Django的http头文件
我在Django中间件中设置了一些非caching头来控制xhr请求的caching。 主要是因为IE严重caching了Ajax请求。 class NeverCacheXhrMiddleware(object): """ sets no-cache headers for all xhr requests xhr requests must send the HTTP_X_REQUESTED_WITH header to be identified correctly as a xhr request using .is_ajax() see: http://stackoverflow.com/questions/49547/making-sure-a-web-page-is-not-cached-across-all-browsers """ def process_response(self, request, response): if request.is_ajax(): #add_never_cache_headers(response) #patch_cache_control(response, no_cache=True) response['Cache-Control'] = 'no-cache, no-store, must-revalidate' response['Pragma'] = 'no-cache' response['Expires'] = '0' return response 当我在开发环境中仅使用Gunicorn部署我的应用程序时,这工作正常。 […]