24

Is it possible to cache assets in github pages? I'm wondering If I should consider moving my webapp from my personal server to github pages and the only thing that's stopping me so far is this.

1 Answer 1

23

The server at github.io certainly does caching.

I have a demo up an running over there and was able to determine that the server sets Last-Modified which allows a client to use If-Modified-Since and get 304 from the server if the data has not been modified since it was last fetched. The server also sets CacheControl: max-age=600. I'm not cache specialist but I understand it to mean that a client may fetch from the cache without revalidating as long as the data is not more than 10 minutes old. If it is more than 10 minutes old, it must check with the server (revalidate) and may get a 304 answer.

The upshot is that a client won't redownload something that has not changed but it make take up to 10 minutes for a client to find that a change occurred.

All this, of course, can change whenever the sysadmins at github.io decide to change it.

2
  • 1
    Caching 10 minutes if very short. The CSS built by Jekyll also contains a hash, so it should be cached forever (since any change will actually request a different URL). The real question is How can I extend Cache-Control on Github pages?
    – rds
    Mar 12, 2018 at 11:34
  • 1
    @rds I asked webapps.stackexchange.com/questions/119286/… to cover that Aug 1, 2018 at 16:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.