[Solved] Cache control for Jekyll-generated HTML files
Hi all :-)
All the homepages I serve with Lighttpd are generated by Jekyll. Now what happens is the following: If I change something and rsync the generated page to my server, browsers (Firefox, Chrome etc.) do not display the changes, but load the old version from their cache, although the last-modified header is updated correctly. Reloading the page yields the updated version.
I use mod_expire to make the browsers cache rarely changed content for a long time, like so:
# mod_expire $HTTP["url"] =~ "^/static/" { expire.url = ( "" => "access plus 1 months" ) }
Files inside /static/ are not updated when reloading, even when I change them server-side, so that a force-update is necessary to reload/update them. That is of course expected behavior of the above configuration.
But why doesn't a browser request an updated file outside of /static/ without a reload, even if the last-modified header is updated? Is there something I can do about this server-side?
Thanks for all help!
Replies (5)
RE: Cache control for Jekyll-generated HTML files - Added by gstrauss 4 months ago
But why doesn't a browser request an updated file outside of /static/ without a reload
Your question about client browser behavior is off-topic for the lighttpd forum.
Learn how to influence client browser caching behavior.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
RE: [Solved] Cache control for Jekyll-generated HTML files - Added by l3u 4 months ago
Excuse me if I get this wrong, but I think submitting a Cache-Control HTTP header for a static HTML file served by Lighttpd is not off-topic for a Lighttpd forum.
I'll try to figure out how to do this. Thanks for the hint.
RE: [Solved] Cache control for Jekyll-generated HTML files - Added by gstrauss 4 months ago
Excuse me if I get this wrong,
You are wrong.
Q1. "My client browser is doing X. How do I change my browser behavior?" => off-topic for this forum.
Q2. Explain to me my client browser behavior => off-topic for this forum.
Q3. My browser cache is over-agressive and I need to set Cache-Control. How do I set Cache-Control on the server? => read the doc mod_setenv
RE: [Solved] Cache control for Jekyll-generated HTML files - Added by l3u 4 months ago
Well, so – as you write yorself – it's about Cache-Control and mod_setenv, about how to configure Lighttpd correctly concerning these settings.
I thus don't really understand your unnecessarily harsh way to answer. Anyway, I think I now know where to read on, so still thanks for pointing me to the right docs.
RE: [Solved] Cache control for Jekyll-generated HTML files - Added by gstrauss 4 months ago
I thus don't really understand your unnecessarily harsh way to answer.
Then ask someone you trust (and not online) to read the above and explain it more slowly to you.
client browser behavior questions are off-topic.