Disable HTTP caching application-wide (e.g. conditional GET)

I have a Rails 6 application that relies on public caching e.g. expires_in 1.week, public: true. These pages must undergo integration tests (Capybara/Headless Chrome), and some pages change state between test cases. In order to prevent sporadic, order-dependent test failures, I want to disable HTTP caching (i.e. “Conditional GET”) in my test suite.

My first intuition, based on the docs, was that setting config.action_controller.perform_caching = false would disable all caching, but this turned out to not be the case. Running config.middleware.delete(Rack::ConditionalGet) also didn’t make a difference.

So:

  1. Is there a clean way to do this?

  2. If there isn’t a way, would there be any interest in a pull request implementing a configuration option, e.g. config.action_controller.http_caching = false ? I’d be happy to contribute it, but only if you feel it’s a potentially worthwhile addition.

Jack