1

How can I check if a website is being cached correctly?

I would like the webpages to be cached by browsers, but I also would like that page updates be visible immediatly when a user visits teh webpage (eg not after a forced reload of the page), so no user ever gets to see stale content.

I'm a bit at a loss here on how to set the headers correctly (using nginx or set them using php...) and I would like to play around with them a bit but I have no clue on how to debug this kind of stuff. so far I've been checking with curl if the headers at least look as expected, but this doesn't indicate if the behaviour will also be as expected..

romeovs
  • 113
  • 4
  • This may be more appropriate for [webmasters.SE](http://webmasters.stackexchange.com/), but check the FAQ and previous questions before asking. – mgorven Feb 20 '13 at 17:43

2 Answers2

0

Google has created some nice documents that are talking about this: Optimize Caching and HTTP Caching.

Basically you put a short expiration date for dynamically generated pages and for static stuff, like files and images, you put a very long expiration time, but you never replace them. If you need to replace static stuff, you will actually give them a new name, and refer them with the new name from the HTML page.

Mircea Vutcovici
  • 17,619
  • 4
  • 56
  • 83
0

Press F12 in your browser to use Developer mode, then click the "network" option or tab. You'll see which requests are sent to the web server and which are retrieved from Cache.

Google's PageSpeed Insights can also help.

user1266898
  • 46
  • 2
  • 9