問題描述
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. 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.
Here are the settings that I am using in my 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. If I change ExpiresDefault A600
to ExpiresByType text/html A600
the problem is still there.
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?
‑‑‑‑‑
參考解法
方法 1:
If you add the Cache‑Control headers in your application, which builds the redirect, apache will not overwrite it.
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.
(by Joe Lencioni、gschaden)