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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
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.
This topic is locked and can not be replied to.