0


I have observe Facebook and Gmail that when we logged out it redirects us to the login page, but the interesting is that when we hit back button it still not go to inbox page.
I have search in google and got something to set attribute "Cache-control" in header. But I don't know how can we implement this mechanism in Rails.
Can anybody suggest me how to do that?
My Rails version is 3.0.6 with Ruby1.9.2

Anand Soni
  • 5,070
  • 11
  • 50
  • 101
  • read this one yet? http://stackoverflow.com/questions/4120289/how-to-clear-browser-cache-after-user-logout-to-prevent-access-to-private-info-vi – Andrei S Jun 01 '11 at 19:55
  • If you are just talking about how to set response headers to stop caching, then see http://stackoverflow.com/questions/711418/how-to-prevent-browser-page-caching-in-rails – colinross Jun 01 '11 at 19:57

1 Answers1

1

You want to set the headers of your page to prevent caching

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
inquisitive
  • 3,738
  • 6
  • 30
  • 56
Shiva
  • 133
  • 1
  • 6