Apache 无法正确识别 mod_wsgi 中添加的标头?
我有一个 Django 应用程序,使用 SessionMiddleware 在 Apache 的 mod_wsgi 守护进程模式下运行。我的 Apache 配置还包含标准 mod_deflate 配置和 mod_cache/mod_disk_cache 以提高性能。
我的问题是,mod_cache 无法正确识别 django 的 SessionMiddleware 设置的 Vary: Cookie,尽管请求 cookie 不同,但 mod_cache 提供页面的缓存版本。删除 mod_deflate 可以解决该问题。在 Apache 中使用 mod_headers 设置 Vary: Cookie(无论 django 中间件如何)也可以解决该问题(这是我的临时解决方法)。
我注意到,在处理这个问题时,似乎在某些情况下,mod_wsgi 应用程序内设置的标头无法被随后出现的一些 Apache 模块正确识别,这对任何人都意味着什么吗?
我有非常标准的 wsgi (附加)和 Apache 配置,请告诉我是否有任何其他数据可以提供帮助。我正在运行库存 ubuntu natty libapache2-mod-wsgi 3.3-2ubuntu2、Apache 2.2.17、django 1.3
I have a django application using the SessionMiddleware running in mod_wsgi daemon mode with Apache. My Apache configuration also contains a standard mod_deflate config and mod_cache/mod_disk_cache for performance.
My problem is that the Vary: Cookie set by django's SessionMiddleware isn't being recognized correctly by mod_cache, which is serving cached versions of pages although the request cookies are different. Removing mod_deflate fixes the problem. Setting Vary: Cookie in Apache with mod_headers (regardless of the django middleware) also fixes the problem (this is my temporary workaround).
I have noticed, while playing around with this, that there seem to be cases where headers set inside the mod_wsgi app aren't properly recognized by some Apache modules that come afterwards, does this mean anything to anyone?
I've got very standard wsgi (attached) and Apache configs, let me know if any other data can help. I'm running stock ubuntu natty libapache2-mod-wsgi 3.3-2ubuntu2, Apache 2.2.17, django 1.3
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
第一步,使用:
http://code.google.com/p/modwsgi /wiki/DebuggingTechniques#Tracking_Request_and_Response
验证 WSGI 应用程序实际发出的内容并传递给 mod_wsgi。
我想不出 mod_wsgi 会导致问题的任何原因,并且听起来更像是 Apache 输出过滤器排序的问题。
顺便说一句,这种问题在 mod_wsgi 邮件列表上得到了更好的处理。通过 StackOverflow 调试问题很糟糕。
As first step, use:
http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Tracking_Request_and_Response
to verify what is actually coming out of the WSGI application and being passed to mod_wsgi.
I can't think of any reason why mod_wsgi would cause an issue and sounds more like an issue with Apache output filter ordering.
BTW, this is the sort of problem better handled on mod_wsgi mailing list. Debugging issues via StackOverflow sucks.