Hello,
To reduce http requests, as well as make the rollout process easier for js/css files, I've setup my php app to do concatenation of js and css files. All included files are sequentially combined into one large file using 2 letter codes for each file (ex. home.js code = "AA"). To generate the names I combine all the codes in the order they are loaded, add an underscore, then the timestamp (ex "AABACE_12345678.js"). Then in the directory they are served out of i'm using an apache directive in htaccess to parse the files with php (sing sethandler) so I can control the headers, and return 301 headers on not changed.
Unfortunately this is not working... I have tested the crap out of it with firebug's Net panel and liveHTTPHeaders. The page is loading the file every time, even if it should have it in cache. Here's an example of the response headers one of the files returns:
Date Wed, 14 Jul 2010 17:00:28 GMT
Cache-Control private
Content-Encoding gzip
Etag "4b4a6d50f9acf924b9dce14e415f5c78"
Expires Wed, 28 Jul 2010 17:00:28 GMT
Vary Accept-Encoding
X-Powered-By PHP/5.2.6
Last-Modified Wed, 14 Jul 2010 16:59:35 GMT
Content-Length 39305
Content-Type text/css
Note: i've omitted some non-caching related headers, like keepAlive, server, etc
I should also note that I'm conditionally gzipping the content, hence the private cache-control header. What am I missing here? The content should be cached because of the expires header. I'm generating the etag from an md5 has of filename+timestamp, so that never changes for the file. Last-Modified never changes, Expires never changes....
Any help/suggestions would be GREATLY appreciated!
[EDIT]
So after further testing, my css files ARE getting cached, but my javascript is not. If I have two files, with IDENTICAL caching headers (etag,expires,last-modified,cache-control) but the only thing different is the content type (one "text/css" one "text/javascript"), ONLY the css is getting cached... frustrating