Forum: Ruby on Rails Dumping browser cache when an error occurs

0ce4db5e1083663c575158643313852c?d=identicon&s=25 Perry Smith (pedzsan)
on 2011-07-03 15:41
I'm thinking this should be part of base Rails.  What do you guys think?

I added this to my application controller:

  protected

  def set_expires_now
    expires_now
    headers.delete('ETag')
    headers.delete('Last-Modified')
  end

Then, when I do a rescue_from, part of the rescue is to call
set_expires_now which causes the response to tagged as uncacheable.
I've had trouble with my users getting a bad page from the server due to
some temporary glitch but when they "refresh", they get the same page.
They have to do shift+refresh (on Firefox) to get a fresh page.

Also, I bumped into a problem with my AJAX replies... if I have an
exception and get the exception response, each attempt to get a new
fresh update results in a 304 response being returned and so the browser
just assumes that the old bad response is valid.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.