# Any suggestions for setting up Global/Wildcard Errors?

**URL:** <https://www.ruby-forum.com/t/any-suggestions-for-setting-up-global-wildcard-errors/227127>\
**Category:** NGINX\
**Created:** [March 5, 2013, 1:57am UTC](https://www.ruby-forum.com/t/any-suggestions-for-setting-up-global-wildcard-errors/227127 "2013-03-05T01:57:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonny](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/47e85d/32.png) [@jonny](https://www.ruby-forum.com/u/jonny)\
**Post date:** [March 5, 2013, 1:57am UTC](https://www.ruby-forum.com/t/any-suggestions-for-setting-up-global-wildcard-errors/227127/1 "2013-03-05T01:57:20Z")

</div>

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
