Register / Login
Win a copy of
The Java Performance Companion
this week in the
Other Java Products and Servers
Apache Cache headers and 301
posted 6 years ago
I am facing a problem related to file caching on apache web server.
I have following header in config file:
But I also have some redirects after this. For e.g. for images I have following redirect:
Redirect permanent /site/images/ http://mysite.com/images/
When I check headers for an
, I am getting this:
HTTP/1.1 301 Moved Permanently Date: Thu, 04 Mar 2010 08:24:32 GMT Server: Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.5 with Suhosin-Patch Location: <image url> Content-Length: 413 Connection: close Content-Type: text/html; charset=iso-8859-1 HTTP/1.1 200 OK Date: Thu, 04 Mar 2010 08:24:32 GMT Server: Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.5 with Suhosin-Patch Last-Modified: Mon, 01 Oct 2007 19:31:56 GMT ETag: "16a91-225-43b737d482300" Accept-Ranges: bytes Content-Length: 549 Cache-Control: max-age=2592000 Expires: Sat, 03 Apr 2010 08:24:32 GMT Connection: close Content-Type: image/gif Load Time : 0.046 seconds
I understand 301 is for redirect of image path and 200 OK is for image. Following lines of response above make it clear that server is sending future date of expiry to browser (IE 6 in this case).
Expires: Sat, 03 Apr 2010 08:24:32 GMT
My question is "why does browser need to go to server at all when it knows it has image in the cache"? How can I prevent 301 calls and how do I know if browser is caching the image (is it considering Expires directive at all??)?
polling a socket
JSON and http header
JSP page not getting displayed
Can't get ImageIcon to show up from captcha