# How to ensure 5xx pages served by nginx dont get cached by users?

**URL:** <https://www.ruby-forum.com/t/how-to-ensure-5xx-pages-served-by-nginx-dont-get-cached-by-users/156065>\
**Category:** NGINX\
**Created:** [December 19, 2008, 11:07pm UTC](https://www.ruby-forum.com/t/how-to-ensure-5xx-pages-served-by-nginx-dont-get-cached-by-users/156065 "2008-12-19T23:07:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nginx.mailinglist](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/a3d4f5/32.png) [@nginx.mailinglist](https://www.ruby-forum.com/u/nginx.mailinglist)\
**Post date:** [December 19, 2008, 11:07pm UTC](https://www.ruby-forum.com/t/how-to-ensure-5xx-pages-served-by-nginx-dont-get-cached-by-users/156065/1 "2008-12-19T23:07:31Z")

</div>

I noticed that under heavy loads nginx returns a default 5xx response  
(503)  
Anyways sometimes users email me saying they encountered the error and  
it  
wont go away, me telling them to clear their browser cache usually  
solves  
the issue, so that leads me to believe these pages are cached

Am i missing something is there an option to make nginx return “no  
cache”  
headers along with a default 5xx error message?

Using nginx 0.6.32 on a few dozen Suse 10.\* and 11.\* servers with  
php5.2.6  
and php-fpm patch

Oh and thank you 🙂

---

<div class="post-metadata">

**Author:** ![nginx.mailinglist](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/a3d4f5/32.png) [@nginx.mailinglist](https://www.ruby-forum.com/u/nginx.mailinglist)\
**Post date:** [December 20, 2008, 12:10am UTC](https://www.ruby-forum.com/t/how-to-ensure-5xx-pages-served-by-nginx-dont-get-cached-by-users/156065/2 "2008-12-20T00:10:16Z")

</div>

Hi,

Are you sure its nginx that is returning the 50x page, and not the  
application behind it? The rails failsafe error handler returns a 200  
status code with some body text that looks like a 503 page.

If it was a real 503 error page (with a 503 status code) then it will  
_not_ be cacheable as 50x error codes are not cacheable by the browser  
or intermediary proxies.

Cheers

Dave

---

<div class="post-metadata">

**Author:** ![nginx.mailinglist](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/a3d4f5/32.png) [@nginx.mailinglist](https://www.ruby-forum.com/u/nginx.mailinglist)\
**Post date:** [December 20, 2008, 2:06am UTC](https://www.ruby-forum.com/t/how-to-ensure-5xx-pages-served-by-nginx-dont-get-cached-by-users/156065/3 "2008-12-20T02:06:39Z")

</div>

yep seems to happen when php fails under heavy load, its kinda hard to  
replicate for me as it seems occur when server is very busy  
and yes some browsers seem to cache these ☹
