是什么原因导致 if-none-match 请求头字段变得巨大?
我的 If-none-match 标头有问题,该标头发送到通过 Apache2/mod_wsgi 运行的 Django CMS 应用程序。
在编辑最常用的页面时,各种用户的浏览器(Chrome 和 FF)都会收到来自 Apache 的错误,抱怨 if-none-match 字段太长。
经过检查(通过wireshark),浏览器在这一标题行中发送大约 8KiB 的 etag。清除浏览器缓存或重新启动并不能解决问题。
我不确定这里出了什么问题。
该字段值的正确解释如下:
浏览器声称了解该页面的数百个先前版本(这是可信的,因为该错误仅发生在严重“获取”快速变化的页面上)。
有没有办法从 FF 或 Chrome 中清除 etag?
谢谢,
克里斯。
I have a problem with the If-none-match header which is sent to a Django CMS App, running through Apache2/mod_wsgi.
When editing the most used page, various users' browsers (Chrome and FF) get an error from Apache complaining that the if-none-match field is too long.
On inspection (through wireshark) the browser is sending about 8KiB if etags in this one header line. Clearing the browser's cache or restarting does not clear the problem.
I'm not sure what is at fault here.
Is the correct interpretation of the field's values as follows:
The browser is claiming to know about a few hundred previous versions of the page (which is credible, as the error only occurs on heavily 'get'ed rapidly-changing pages).
Is there a way of clearing out etags from FF or Chrome?
Thanks,
Chris.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对您来说,最好从一开始就阻止 Django 生成 ETag。由于 Django 仅在页面呈现后生成它们,因此它们不会节省您的服务器资源 - 只是带宽。如果您的瓶颈不是带宽,您可以通过在设置文件中设置
USE_ETAGS = False
来禁用它们。详细信息在这里: http://docs.djangoproject.com/ en/1.2/ref/settings/#std:setting-USE_ETAGS
It may be best for you to just prevent Django from generating ETags in the first place. Since Django only generates them after a page has rendered, they don't save you server resources--just bandwidth. If your bottleneck isn't bandwidth, you can just disable them by setting
USE_ETAGS = False
in your settings file.Details are here: http://docs.djangoproject.com/en/1.2/ref/settings/#std:setting-USE_ETAGS