# Dumping browser cache when an error occurs

**URL:** <https://www.ruby-forum.com/t/dumping-browser-cache-when-an-error-occurs/209029>\
**Category:** Rails\
**Created:** [July 3, 2011, 3:41pm UTC](https://www.ruby-forum.com/t/dumping-browser-cache-when-an-error-occurs/209029 "2011-07-03T15:41:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [July 3, 2011, 3:41pm UTC](https://www.ruby-forum.com/t/dumping-browser-cache-when-an-error-occurs/209029/1 "2011-07-03T15:41:12Z")

</div>

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.
