5

So I've got a simple static site that I update on a pretty regular basis. (It's a blog, built with Jekyll.) The problem is that browsers* seem to be caching the pages and hiding updates from returning viewers.

One obvious option is to do something like this for the landing page where the updates mostly occur. Except I'm not necessarily against caching; I just want to make sure that a newer version on the server supersedes the cached version. Thoughts on how to accomplish this?

*I've only observed this directly on Chrome, but I imagine the same problem exists with other browsers.

Community
  • 1
  • 1
Mike Craig
  • 1,567
  • 1
  • 12
  • 21

1 Answers1

3

Caching control can be set to have time limits as specified in RFC 2616.

This is done by setting HTTP headers similar to:

Cache-Control: max-age=3600, must-revalidate
Expires: Fri, 30 Oct 1998 14:19:41 GMT
Last-Modified: Mon, 29 Jun 1998 02:28:12 GMT

The automatic creation of these headers varies with webserver, but for Apache, it can be done using mod_expires.

Don Roby
  • 39,169
  • 6
  • 84
  • 105