Search code examples
cachingbrowserbrowser-cachecache-control

GET request served from cache in firefox but not in chrome?


I did put the the test.html under tomcat web server. I acess it from firefox , first time it is served from webserver Second time it is served from cache as firebug console displays 0 request . Reason i believe is firefix automatically sets some expiry time (in this case around 3 mins after page is served)

But on chrome i see every time it is fetched fresh from server. Reason i believe is below header that chrome is sending as request header (don't see this header in firefox) but i do not see any expire time set here in chrome

Cache-Control:max-age=0

So is this discprency specific to browser. I mean firefox sets expire time but not chrome if ? Similarly Chrome sends the request header Cache-Control:max-age=0 but firefox does not.


Solution

  • To avoid any speculations regarding caching from browsers perspective, just specify in response headers how browser should treat your resources. But usually, if you haven't specified any caching headers, then browser will cache your request for 10% of time passed since date which is set in Last-Modified response header.