Way to set default Rails Cache-Control header?
Asked Answered
T

0

8

I know that to set the Cache-Control header in my own controllers I can call #expires_now, but my Rails app uses an engine (apitome), and on those requests, the Cache-Control header gets set to max-age=0, private, must-revalidate. I see that may be the default value for Rack::ETag here, but I can't figure out how to override it.

When I set Rails.configuration.public_file_server.headers = { 'Cache-Control' => 'no-cache' }, that changes the header for my javascript assets for example, but not the engine.

Is there a way to override the default or a good way to set this setting in the engine? Maybe just monkey patch the controller and add a before_action to set the header?

Tanked answered 22/9, 2017 at 23:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.