Fix frequent page change cache issue #552

Closed
rhtyd opened this Issue May 12, 2012 · 6 comments

Comments

Projects
None yet
5 participants

rhtyd commented May 12, 2012

Applies to Github pages and maybe elsewhere: In a jekyll blog if a post or page is edited frequently or otherwise, the blog post or page when opened fails to show current version due to browser caching, squid proxy server caching (in my case) etc.

Is this fixable? How can this issue be fixed, perhaps fixing options in the webserver, HTTP header etc?

alexcp commented May 25, 2012

You should look at the Html Cache-Control Header. My guess is that Squid or the webserver is responsible unless you defined in the html.

I know that Rails use a clever technique with the asset pipeline to overcome the problem by adding a md5 checksum to the file names when they are compile, so if a file change, the new file will be serve (new name).

rhtyd commented May 26, 2012

Yes, as I mentioned my Internet access is through a squid proxy server which is responsible for this issue.

So, if I don't have access to the squid proxy server, is there still any way to fix this issue?

Owner

parkr commented Jun 15, 2012

If possible, as @alexcp mentioned, add an md5 hash to the end of your files as a query string. If you set it in your config.yml, you should be able to use it everywhere.

Alternatively, modify the Cache-Control header.

rhtyd commented Jun 15, 2012

Yeah, md5 hash will be a ugly hack but that should work. Thanks.

@rhtyd rhtyd closed this Jun 15, 2012

why-el commented Sep 16, 2012

Hey anybody with a follow up on this? I am not sure how you can automate the appending of md5 hashes to posts.

Owner

parkr commented Sep 17, 2012

If the files which are not updating are being called in in the html, you can create a Liquid Tag which, when called, will spit out a md5 hash or a timestamp of the current build and you can append the output to the <link href="url"> or whatever.

If you're looking for a specific cache expiry date:

<meta http-equiv="EXPIRES" content="Mon, 17 Sep 2012 12:00:00 GMT">

Or you can set the page to refuse to be cached:

<meta http-equiv="CACHE-CONTROL" content="NO-CACHE">

@jekyllbot jekyllbot locked and limited conversation to collaborators Feb 27, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.