module Scrivito class DisableBrowserCacheForUiMiddleware def initialize(app) @app = app end def call(env) status, headers, response = @app.call(env) editing_context = EditingContextMiddleware.from_env(env) if editing_context.authenticated_editor? headers['Cache-Control'] = 'no-store, must-revalidate' end [status, headers, response] end end end