Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cache control header not working

I have set Cache control in my response header as Cache-Control:public, max-age=86400. But when I try to refresh page or open a new tab, it always hits my server. The response status I got is 200, server log is appeared for this request also I checked chrome://cache/ this request is not in the list. I already looked some similar SO questions cache-control not working without etag and why cache-control:max-age don't work?. But still with no luck. Tested on chrome 56.

like image 789
Mengo Avatar asked Mar 07 '17 23:03

Mengo


Video Answer


2 Answers

Chrome disables cache when DevTools is open, or at least it does Chrome 59. Open DevTools, go to Network, uncheck "Disable cache" at the top. Now you should be able to refresh the page and see it in chrome://cache.

like image 180
mwp Avatar answered Sep 27 '22 21:09

mwp


Cache control tells your browser (and proxy servers like Squid) what resources it cannot cache. But it does not force your browser to cache a resource.

like image 23
Larry B. Avatar answered Sep 27 '22 21:09

Larry B.