Reset session if user click back button in browser

Valentino Lun wrote:

Dear all

Can rails reset session if user click the back button in browser?

1. go to
2. Search something and display the result
3. go to
4. click back button, I still can see the result in browser, but I don't
want to see the browser cache...

Any idea to implement this feature? Please advise. Million thanks....


Have you tried setting a

Cache-Control: no-cache, no-store

in your header?

Or an expires header?

or the 'varying URL' trick...

There is some (fairly aged) info at

Thanks for your reply

I put the following code in my application controller

    before_filter :set_cache_buster

    def set_cache_buster
        response.headers["Cache-Control"] = "no-cache, no-store,
max-age=0, must-revalidate"
        response.headers["Pragma"] = "no-cache"
        response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"

It will not cache the dynamic content if back button is pressed, but the
session is still here....

Many thanks

Ar Chron wrote: