Any suggestions for setting up Global/Wildcard Errors?

I’m surprised this hasn’t come up before ( I’ve looked on this archive +
Stack Overflow )

There doesn’t seem to be a way to catch all errors in nginx. They need
to all be specified.

I’m using nginx with proxy_intercept_errors, so there can be many
different codes.

I’ve built out all the codes, but I just wanted to bring this up to the
community, in case anyone has a better suggestion ( or wants to build in
functionality )

I was hoping to use try_files to display custom error pages , then
failover to a ‘standard’ html page if the custom doesn’t work.

this idea is possible , but requires every code to be set :

error_page 401 /error/401.html;
error_page 402 /error/402.html;
error_page 403 /error/403.html;
error_page 404 /error/404.html;
location /error {
internal;
root /var/www/MySite.com/static ;
try_files $uri /error/standard.html;
}

another issue, is that conditional types of 404s are often useful. a
javascript or a css request might be best be handled by serving the
error as a blank file , or something with some sort of semantic notion
within.

location /js {
error_page 404 /error/404.js;
}
location /css {
error_page 404 /error/404.css;
}

i’m not sure how others handle situations like this , but am interested

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs