Mixing mod_expires and mod_headers

The cache-control header gives you granular control over the caching behavior, it has directives like s-maxage, public, private in addition to the max-age directive.

The mod_expires module can be used for setting only max-age directive but what is you want to configure the proxy related directives say you want to set Cache-Control to something like this


Cache-Control max-age=7776000, public,s-maxage=2592000


This means the browser can cache the resource for 3 months but the public cache, such as cache proxy can cache it for 1 month.

You should use mix of mod_expires and mod_headers to set these headers by adding following lines to the httpd.conf


ExpiresActive On

<FilesMatch "\.(gif|jpg|jpeg|png|swf)$">
ExpiresDefault "access plus 3 month"
Header append Cache-Control "public,s-maxage=2592000"
</FilesMatch>


This configuration will tell Apache HTTP Server to set 3 month caching for browser and 1 month caching for cache proxy only for resources with gif|jpg|jpeg|png|swf extension.

This is screen shot of Firefox when i try to access a image from HTTP server that has the above configuration

3 comments:

srjwebsolutions said...

We are leading responsive website designing and development company in Noida.
We are offering mobile friendly responsive website designing, website development, e-commerce website, seo service and sem services in Noida.

Responsive Website Designing Company in Noida
Website Designing Company in Noida
SEO Services in Noida
SMO Services in Noida

Vikas Chaudhary said...

Battery Mantra is Authorized exide car battery dealer in Noida and Greater Noida. We are providing our service in Indirapuram, Delhi, Ashok Nagar.

Exide Battery Dealer in Noida
Battery Dealer in Noida
Authorized Battery Dealer in Noida
Car Battery Dealer in Noida
Car Battery Dealer
Exide Battery Dealer

EG MEDI said...

Egmedi.com is online medical store pharmacy in laxmi nagar Delhi. You can Order prescription/OTC medicines online.
Cash on Delivery available. Free Home Delivery


Online Pharmacy in Delhi
Buy Online medicine in Delhi
Online Pharmacy in laxmi nagar
Buy Online medicine in laxmi nagar
Onine Medical Store in Delhi
Online Medical store in laxmi nagar
Online medicine store in delhi
online medicine store in laxmi nagar
Purchase Medicine Online
Online Pharmacy India
Online Medical Store