apache - mod_expires 还是 mod_headers?

标签 apache browser-cache mod-expires mod-headers

This page说:

If a response includes both an Expires header and a max-age directive, the max-age directive overrides the Expires header, even if the Expires header is more restrictive



似乎 mod_expires 和 mod_headers 在我的服务器中都处于事件状态。
其中哪一个更可取,您能评论一下它们各自的优点吗?
谢谢你。

最佳答案

您可能只想使用 mod_expires,因为这允许自动发送 Cache-Control header 和 Expires header ,并且可以允许您指定访问时间和文件修改时间。它还允许您按文件类型设置不同的默认值。

使用 mod_expires 您可以使用以下指令设置默认到期时间:

ExpiresDefault "access plus 2 days"

当然 mod_headers 是一个更通用的模块,它允许您做一些相同的事情,但通常更多地用于创建自定义标题或管理多个(可能是冲突的)标题。

关于apache - mod_expires 还是 mod_headers?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12164684/

相关文章:

apache - Expires 指令 - 修改基础 VS Access 基础

regex - HTTPS 强制重定向在 Wordpress 中不起作用

css - 作为查询参数的缓存断路器与文件名中的缓存断路器

Firefox 使 DNS 缓存失效

javascript - 如何防止浏览器后退按钮重新显示我的用户通知?

.htaccess - 如何设置缓存修改后过期呢?

Apache:在所有虚拟主机上启用维护模式

mysql - 如何使 Apache 用户跟踪 cookie 为十进制而不是十六进制?

php - 用于 PHP 的服务器端 Web 浏览器?