apache - mod_expires 为 3## 状态码发送 Cache-Control header

标签 apache redirect cache-control browser-cache mod-expires

Apache 正在发送 3## 状态代码的 Cache-Control header ,例如 302 重定向。这导致 Firefox(可能从 Firefox 5 开始)缓存 302 重定向——这导致我的某些页面出现无限重定向循环。

这是我在 httpd.conf 中使用的设置:

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

如果我删除 ExpiresDefault 设置,问题就会消失,所以我确信这是导致问题的确切设置。如果我改变 ExpiresDefault A600ExpiresByType text/html A600问题仍然存在。

我想让浏览器默认缓存我的内容,但这会破坏交易。

我可以使用任何设置来告诉 Apache 为 3## 状态代码发送不同的 Cache-Control header 吗?

最佳答案

如果您在构建重定向的应用程序中添加 Cache-Control header ,则 apache 不会覆盖它。

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

如果您使用 apaches mod_rewrite 进行重定向,您可以添加带有
mod_headers模块。

关于apache - mod_expires 为 3## 状态码发送 Cache-Control header ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6904215/

相关文章:

java - 自定义字段的 Apache log4 J DB 配置

ruby-on-rails - 云端重定向到原点而不是别名

php - 在magento中将http上的整个页面重定向到https

c++ - 缓存在处理设备时会有限制吗?

javascript - GAE/P 中静态文件的自动版本控制

javascript - Apache 404 错误 - Drupal

Php Composer openssl错误

java - 在 java 程序中使用 Apache UIMA 的示例

asp.net - C# WebBrowser 控件将网页另存为图片,重定向问题

java - 如何设置Pragma : no-cache HTTP header in Jersey?