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
It seems like both of the mod_expires and mod_headers are active in my server.
Which of them is preferable and can you comment the advantages of each of them?
Thank you.
Module: mod_expires. This directive defines the value of the Expires header and the max-age directive of the Cache-Control header generated for documents of the specified type (e.g., text/html ). The second argument sets the number of seconds that will be added to a base time to construct the expiration date.
You can simply use apachectl -M command to list all the enabled modules in Apache web server. Since the output contains a list of all installed modules in Apache, we can pass its output to grep and search for “expires” string. If the output contains “expires_module” it means mod_expires is enabled.
Mod_expires is an Apache module that is used to manipulate the Expires HTTP header and the max-age directive of the Cache-Control header. These two HTTP headers instruct the internet browser of the client for how long should particular documents and files be cached.
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. It also allows you to set different defaults by file type.
Using mod_expires you could set the default expiry using the following directive:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With