Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I may be wrong in assuming this, but if I've set an expires header of access plus 1 year on a file, and I can see that in the header, when I make another request for that file, shouldn't it just be cached in the browser so I never actually see the request on the server?

I have these response headers on an img:

Date:Mon, 05 Jul 2010 16:17:08 GMT
Expires:access plus 1 year
Keep-Alive:timeout=15, max=98
Server:Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny6 with Suhosin-Patch

But when I refresh, I still see the request to that image in my apache access log. Is that the expected behaviour? I figured the request would never even make it to my server.

BTW this is what i'm using to set expires headers:

RewriteCond %{REQUEST_FILENAME} ^\/(images|assets|pdfs) [NC]
RewriteRule ^(.*)$ $1 [E=set_expires_header:true,L]
Header add Expires "access plus 1 year" env=set_expires_header
share|improve this question
up vote 0 down vote accepted

Check out the documentation for mod_expires. It has a feature ExpiresByType which will save you the mod_rewrite rule. It also has support for your English verbiage to add the expires header based on access time. I don't believe mod_headers is smart enough to figure out what you mean by what you typed, so BMDan is correct in the date format.

share|improve this answer

Unfortunately, that's not a valid Expires header. See , and specifically, , which defines an "HTTP-date".

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.