Force client browser to clear cache after tenant switch
I have a Rail app where the user can switch tenants (activerecord_acts_as_tenant). The issue is that in production the browser is caching the old client HTML etc.
I came across this:
headers["Cache-Control"] = "no-cache, no-store, must-revalidate" # HTTP 1.1. headers["Pragma"] = "no-cache" # HTTP 1.0. headers["Expires"] = "0" # Proxies.
I have a controller that sets a session variable and then redirects to root. I want to 'reset' the cache etc. at this point but I can't seem to figure out how to implement this.
It's very bizzare. The browser keeps the old HTML even over manual refreshes. Tried again this morning to have the site even load the page after Devise had timed out. The datatables failed as they were calling JSON from the live site but authentication failed so they throw errors.