# Internal 503 Redirect Issues?

**URL:** <https://www.ruby-forum.com/t/internal-503-redirect-issues/224393>\
**Category:** NGINX\
**Created:** [November 9, 2012, 7:27pm UTC](https://www.ruby-forum.com/t/internal-503-redirect-issues/224393 "2012-11-09T19:27:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [November 9, 2012, 7:27pm UTC](https://www.ruby-forum.com/t/internal-503-redirect-issues/224393/1 "2012-11-09T19:27:13Z")

</div>

Hello Everyone,

I am attempting to configure an internal redirect for any 502/503 errors  
in  
the event our backend servers are down. Here is the relevant part of my  
configuration:

location / {  
add\_header X-Frame-Options SAMEORIGIN;  
proxy\_set\_header Host $host;  
proxy\_set\_header X-Real-IP $remote\_addr;  
proxy\_set\_header X-Forwarded-For  
$proxy\_add\_x\_forwarded\_for;  
proxy\_next\_upstream error timeout invalid\_header;  
proxy\_intercept\_errors on;  
error\_page 502 503 504 @errors;  
proxy\_pass http://jboss\_dev\_servers;

```
    }

```

location @errors {  
root /usr/share/nginx/html;  
try\_files $uri /50x.html =503;  
}  
}

If I disable JBoss on my backend server, the 500 status code is  
intercepted  
and the 50x.html page is displayed. However, I am only receiving a  
partial  
page render. It’s almost like part of my .css file is not being sent to  
the  
browser, as I get the text and images, but none of my CSS formatting.

Here is my /usr/share/nginx/html directory structure, all users have  
read  
access to the directories and files:

-rw-r–r-- 1 root root 8035 2012-11-09 13:06 50x.html  
drwxr-xr-x 2 root root 4096 2012-11-09 12:21 images  
drwxr-xr-x 2 root root 4096 2012-11-09 12:21 js  
drwxr-xr-x 2 root root 4096 2012-11-09 12:21 styles

Here is a screenshot of how the page renders:  
[https://dl.dropbox.com/u/1540472/oops.png](https://dl.dropbox.com/u/1540472/oops.png)

I think my @error location is configured incorrectly, but I’ve been  
beating  
my head against a wall for an hour or so. Any ideas?

Thanks,

Matt

Posted at Nginx Forum:

> **[Internal 503 Redirect Issues?](https://forum.nginx.org/read.php?2,232655,232655#msg-232655)**
>
> Hello Everyone, I am attempting to configure an internal redirect for any 502/503 errors in the event our backend servers are down. Here is the relevant part of my configuration: location / { add\_header X-Frame-Options SAMEORIGIN;

---

<div class="post-metadata">

**Author:** ![mevans336](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3da27b/32.png) [@mevans336](https://www.ruby-forum.com/u/mevans336)\
**Post date:** [November 10, 2012, 1:15pm UTC](https://www.ruby-forum.com/t/internal-503-redirect-issues/224393/2 "2012-11-10T13:15:15Z")

</div>

the URL of css

–  
侲棬ȶУʱ費  
from iPad2 3G

---

<div class="post-metadata">

**Author:** ![mevans336](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3da27b/32.png) [@mevans336](https://www.ruby-forum.com/u/mevans336)\
**Post date:** [December 1, 2012, 8:54am UTC](https://www.ruby-forum.com/t/internal-503-redirect-issues/224393/3 "2012-12-01T08:54:07Z")

</div>

Apparently, from what I gather, if a 503 is returned the browsers  
(Chrome/IE10 I’ve tested) don’t parse css, even if they can access them.  
I’ve verified this by typing the direct URL to the CSS file hosted on  
Nginx.

I’m positive my code (HTML/CSS) is right.

So how does one redirect to a page hosted on Nginx acting as a reverse  
proxy  
when the backend servers are down, while preserving CSS?

Posted at Nginx Forum:

> **[Re: Internal 503 Redirect Issues?](https://forum.nginx.org/read.php?2,232655,233450#msg-233450)**
>
> Hello Everyone, I am attempting to configure an internal redirect for any 502/503 errors in the event our backend servers are down. Here is the relevant part of my configuration: location / { add\_header X-Frame-Options SAMEORIGIN;

---

<div class="post-metadata">

**Author:** ![mevans336](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3da27b/32.png) [@mevans336](https://www.ruby-forum.com/u/mevans336)\
**Post date:** [December 3, 2012, 10:56pm UTC](https://www.ruby-forum.com/t/internal-503-redirect-issues/224393/4 "2012-12-03T22:56:17Z")

</div>

I resolved this by simply using an internal style sheet.

Posted at Nginx Forum:

> **[Re: Internal 503 Redirect Issues?](https://forum.nginx.org/read.php?2,232655,233529#msg-233529)**
>
> Hello Everyone, I am attempting to configure an internal redirect for any 502/503 errors in the event our backend servers are down. Here is the relevant part of my configuration: location / { add\_header X-Frame-Options SAMEORIGIN;
