0

I have a few raw .html files in /public that are still being cached after I edit and deploy them. The goal is not to have to ask clients to clear their cache when the files change (often).

My production.rb contains this:

# Use a different cache store in production
# pks: recommended by heroku
config.cache_store = :dalli_store

# For Rack::Cache on heroku
# Modify your config/environments/production.rb environment file to specify
# the appropriate storage backends for Rails’ built-in Rack::Cache integration.
config.action_dispatch.rack_cache = {
    :metastore    => Dalli::Client.new,
    :entitystore  => 'file:tmp/cache/rack/body',
    :allow_reload => false
}
# To allow your application to properly serve, invalidate and refresh static assets 
config.serve_static_assets = true
config.static_cache_control = "public, max-age=0" # 2592000" # max-age=0 to to force revalidate
config.assets.digest = true
config.action_controller.perform_caching = true    

HTTP Headers for static html asset

Thanks!

patrickkidd
  • 2,797
  • 2
  • 19
  • 19

1 Answers1

0

I think you might be able to just create a script that you run whenever you want to deploy that calls whatever command you use to deploy and then uses the commands listed within the following post (How can I clear rails cache after deploy to heroku?)

Community
  • 1
  • 1
Drew
  • 2,583
  • 5
  • 36
  • 54