# Nginx + HAProxy, custom 503 Error

**URL:** <https://www.ruby-forum.com/t/nginx-haproxy-custom-503-error/183655>\
**Category:** NGINX\
**Created:** [February 18, 2010, 7:25am UTC](https://www.ruby-forum.com/t/nginx-haproxy-custom-503-error/183655 "2010-02-18T07:25:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmadtech](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7cd45c/32.png) [@jmadtech](https://www.ruby-forum.com/u/jmadtech)\
**Post date:** [February 18, 2010, 7:25am UTC](https://www.ruby-forum.com/t/nginx-haproxy-custom-503-error/183655/1 "2010-02-18T07:25:15Z")

</div>

Hey all,

I’m currently using Nginx & HAProxy with a Rails Application on the  
backend (using mongrels).

I’ve configured my Nginx config file with a custom 50x error page:

error\_page 500 502 503 /500.html;  
location = /500.html {  
internal;  
}

If I shut my mongrels off and try to access the page, I get the default  
503 error page that comes with Nginx, not my custom 500.html page.  
Turning on my mongrels and turning off the database generates a 500  
error and I get the default 500 error page as well.

However, I also have a similar declaration for a 504 timeout or a 404  
page not found error and they work just fine.

error\_page 504 /504.html;  
location = /504.html {  
internal;  
}

error\_page 404 /404.html;  
location = /404.html {  
internal;  
}

I verified that the 500.html file exists and has the proper permissions.  
Am I missing something?

Thanks in advance

Posted at Nginx Forum:

> **[Nginx + HAProxy, custom 503 Error](https://forum.nginx.org/read.php?2,55364,55364#msg-55364)**
>
> Hey all, I'm currently using Nginx & HAProxy with a Rails Application on the backend (using mongrels). I've configured my Nginx config file with a custom 50x error page: error\_page 500 502 503 /500.html; location = /500.html { i

---

<div class="post-metadata">

**Author:** ![jmadtech](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7cd45c/32.png) [@jmadtech](https://www.ruby-forum.com/u/jmadtech)\
**Post date:** [February 18, 2010, 10:58am UTC](https://www.ruby-forum.com/t/nginx-haproxy-custom-503-error/183655/2 "2010-02-18T10:58:51Z")

</div>

Hello!

On Thu, Feb 18, 2010 at 01:24:34AM -0500, jmadtech wrote:

> ```
> internal;
> 
> ```
> 
> }
> 
> If I shut my mongrels off and try to access the page, I get the  
> default 503 error page that comes with Nginx, not my custom  
> 500.html page. Turning on my mongrels and turning off the  
> database generates a 500 error and I get the default 500 error  
> page as well.

> **[GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki...](https://github.com/nginxinc/nginx-wiki)**
>
> ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com

Maxim D.
