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?

say,
1. go to http://myapp.com/controller
2. Search something and display the result
3. go to http://another_server.com
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....

Valentino

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
http://blog.httpwatch.com/2008/10/15/two-important-differences-between-firefox-and-ie-caching/

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"
    end

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

Many thanks
Valentino

Ar Chron wrote: