Forum: NGINX Internal 503 Redirect Issues?

Posted by mevans336 (Guest)
on 2012-11-09 19:27
(Received via mailing list)
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

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: 
http://forum.nginx.org/read.php?2,232655,232655#msg-232655
Posted by "任晓磊" <julyclyde@gmail.com> (Guest)
on 2012-11-10 13:15
(Received via mailing list)
the URL of css

--
侲棬ȶУʱ費
from iPad2 3G
Posted by mevans336 (Guest)
on 2012-12-01 08:54
(Received via mailing list)
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: 
http://forum.nginx.org/read.php?2,232655,233450#msg-233450
Posted by mevans336 (Guest)
on 2012-12-03 22:56
(Received via mailing list)
I resolved this by simply using an internal style sheet.

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?2,232655,233529#msg-233529
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.