简体   繁体   English

mod_expires或mod_headers?

[英]mod_expires or mod_headers?

This page says this: 这个页面说明了这个:

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 如果响应包括Expires头和max-age指令,则max-age指令会覆盖Expires头,即使Expires头更具限制性

It seems like both of the mod_expires and mod_headers are active in my server. 似乎mod_expires和mod_headers都在我的服务器中处于活动状态。
Which of them is preferable and can you comment the advantages of each of them? 哪一个更可取,你能评论每个人的优势吗?
Thank you. 谢谢。

You probably just want to use mod_expires, as this allow for sending of both Cache-Control header and Expires headers automatically and can allow you to specify by both access time and file modification time. 您可能只想使用mod_expires,因为这允许自动发送Cache-Control标头和Expires标头,并允许您通过访问时间和文件修改时间来指定。 It also allows you to set different defaults by file type. 它还允许您按文件类型设置不同的默认值。

Using mod_expires you could set the default expiry using the following directive: 使用mod_expires,您可以使用以下指令设置默认到期时间:

ExpiresDefault "access plus 2 days"

Of course mod_headers is a much more general module that allows you to do some of the same stuff, but generally used more for creating custom headers or manage multiple (possibly conflicting) headers. 当然mod_headers是一个更通用的模块,它允许你做一些相同的东西,但通常用于创建自定义标头或管理多个(可能是冲突的)标头。

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

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