# Different error code during proxied backend restart?

**URL:** <https://www.ruby-forum.com/t/different-error-code-during-proxied-backend-restart/123417>\
**Category:** NGINX\
**Created:** [December 17, 2007, 3:00pm UTC](https://www.ruby-forum.com/t/different-error-code-during-proxied-backend-restart/123417 "2007-12-17T15:00:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kappa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/50afbb/32.png) [@kappa](https://www.ruby-forum.com/u/kappa)\
**Post date:** [December 17, 2007, 3:00pm UTC](https://www.ruby-forum.com/t/different-error-code-during-proxied-backend-restart/123417/1 "2007-12-17T15:00:35Z")

</div>

At the moment, nginx (I use 0.5.33) reports 404 (Not Found) when the  
(reverse-) proxied backend is unavailable (for example, while it is  
being restarted).

I think it is somewhat confusing, both for normal users, and for bots.

Wouldn’t it be better to report 503 (Service Unavailable)?

---

<div class="post-metadata">

**Author:** ![kappa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/50afbb/32.png) [@kappa](https://www.ruby-forum.com/u/kappa)\
**Post date:** [December 17, 2007, 3:08pm UTC](https://www.ruby-forum.com/t/different-error-code-during-proxied-backend-restart/123417/2 "2007-12-17T15:08:46Z")

</div>

On Mon, Dec 17, 2007 at 02:48:58PM +0100, Marcin K. wrote:

> At the moment, nginx (I use 0.5.33) reports 404 (Not Found) when the  
> (reverse-) proxied backend is unavailable (for example, while it is  
> being restarted).
> 
> I think it is somewhat confusing, both for normal users, and for bots.
> 
> Wouldn’t it be better to report 503 (Service Unavailable)?

In this case nginx reports 502.  
Could you make debug log of this request ?

---

<div class="post-metadata">

**Author:** ![kappa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/50afbb/32.png) [@kappa](https://www.ruby-forum.com/u/kappa)\
**Post date:** [December 17, 2007, 7:11pm UTC](https://www.ruby-forum.com/t/different-error-code-during-proxied-backend-restart/123417/3 "2007-12-17T19:11:49Z")

</div>

> In this case nginx reports 502.  
> Could you make debug log of this request ?

I found what is going on, finally. nginx indeed wants to report 502,  
but then fails to find the file for 502 error:

2007/12/17 18:55:00 [error] 28745#0: \*6 connect() failed (111:  
Connection refused) while connecting to upstream, (…)  
2007/12/17 18:55:00 [error] 28745#0: \*6 open()  
“/var/www/nginx-default/50x.html” failed (2: No such file or directory),  
(…)

nginx wants to load this file as I have in my nginx.conf the line  
(IIRC put there by default in the debian package)

error\_page 500 502 503 504 /50x.html;

but the 50x.html file is in /var/www/nginx-errors, not in  
/var/www/nginx-default.

So in the end it seems like some packaging inconsistency or my  
forgotten mistake (I do not remember myself messing with those  
params or files, but maybe …).

PS I am still not sure whether it would not be better to keep the  
original error here, but I do not know for sure.
