I'm setting long term expires headers on all of my assets. However, there are some static HTML files (for a Jekyll blog) in my public directory, that are getting cached and there is no cache busting in place for them when updated. It actually just seems to be my main index.html
file, located in app/public/blog
, that keeps getting caught in the cache.
Is it as simple as changing the "public" in the config?
config.static_cache_control = "public, max-age=604800"
I know this is an old question, but I keep finding it, when I look this up (I keep looking this up), so here's the answer:
No, the public in config.static_cache_control
does NOT refer to the rails public/ directory.
In fact this whole string is a literal used as the Cache-Control
header when serving static assets (including both public/ and sprockets-compiled assets in assets/).
See http://guides.rubyonrails.org/asset_pipeline.html#cdns-and-the-cache-control-header for the details on how config.static_cache_control is used in rails and http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9 for the w3c docs on the meaning of the Cache-Control header.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With