简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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