简体   繁体   English

mod_expires为3个##状态代码发送Cache-Control标头

[英]mod_expires sending Cache-Control headers for 3## status codes

Apache is sending Cache-Control headers for 3## status codes, like 302 redirects. Apache正在为3 ##状态代码发送Cache-Control标头,如302重定向。 This is causing Firefox (possibly starting with Firefox 5) to cache the 302 redirects--which results in an infinite redirect loop for some of my pages. 这导致Firefox(可能从Firefox 5开始)缓存302重定向 - 这导致我的某些页面无限重定向循环。

Here are the settings that I am using in my httpd.conf : 以下是我在httpd.conf使用的设置:

<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault A600
</IfModule>

If I remove the ExpiresDefault setting, the problem goes away, so I am confident that this is the exact setting that is causing the problem. 如果我删除了ExpiresDefault设置,问题就会消失,所以我确信这是造成问题的确切设置。 If I change ExpiresDefault A600 to ExpiresByType text/html A600 the problem is still there. 如果我将ExpiresDefault A600更改为ExpiresByType text/html A600 ,问题仍然存在。

I'd like to have browsers cache my content by default, but this is a deal-breaker. 我希望默认情况下让浏览器缓存我的内容,但这是一个交易破坏者。

Are there any settings I can use to tell Apache to send a different Cache-Control header for 3## status codes? 是否有任何设置可以告诉Apache为3 ##状态代码发送不同的Cache-Control标头?

If you add the Cache-Control headers in your application, which builds the redirect, apache will not overwrite it. 如果在构建重定向的应用程序中添加Cache-Control标头,则apache不会覆盖它。

Cache-Control: max-age=0
Expires: Sat, 04 Feb 2012 07:02:38 GMT

if you use apaches mod_rewrite to do the redirect you could add the headers with the mod_headers module. 如果您使用apach mod_rewrite进行重定向,则可以使用mod_headers模块添加标头。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM