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:
Connection:Keep-Alive
Date:Mon, 05 Jul 2010 16:17:08 GMT
Etag:"9cc4b2-73b-48a43cbb63300"
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
Unfortunately, that's not a valid Expires header. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21 , and specifically, http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 , which defines an "HTTP-date".
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.