Internal 503 Redirect Issues?

mevans336 nginx-forum at
Fri Nov 9 18:26:35 UTC 2012

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

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_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:

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?



Posted at Nginx Forum:,232655,232655#msg-232655

More information about the nginx mailing list