-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show non 500 default NGINX error pages for various upstream errors #158
Conversation
Currently this uses `try_files` but we don't actually have any of them. This means we get the NGINX fallback page instead with the right code. In future we can add nicer pages.
2893c84
to
b8e9b6e
Compare
error_page 404 410 = @proxy_not_found; | ||
error_page 420 429 = @proxy_too_many_requests; | ||
error_page 400 401 402 403 405 406 407 408 409 411 412 413 414 415 416 417 418 422 423 424 425 426 428 431 444 449 450 451 = @proxy_client_error; | ||
error_page 500 501 502 503 504 505 506 507 508 509 510 511 598 599 = @proxy_upstream_error; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some attempt has been made to split out different cases we might find interesting. In particular "too many requests" type errors could be very interesting to us, and would be otherwise mixed in with other 400s. 404's also seem like a useful thing to reply to the user.
As far as I can tell, there's no way of using pattern matching here to say 5**
. So we have to list everything we can think of.
@@ -60,6 +67,26 @@ http { | |||
add_header "X-Via" "static-proxy, redirect"; | |||
} | |||
|
|||
location @proxy_not_found { | |||
# Not found / gone => 404 not found | |||
try_files /proxy/not_found.html =404; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These files don't have to exist yet. NGINX will try them, not find them and fallback to internal defaults.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to proxy 404s? I guess why not--these won't be considered as "errors" by monitoring services like Elastic Beanstalk's, they shouldn't cause any false alarms in monitoring or alerting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think 404 is one of the few HTTP codes which are understood by lay-people, so it's probably a good idea.
Currently this uses
try_files
but we don't actually have any of them. This means we get the NGINX fallback page instead with the right code.In future we can add nicer pages.
Testing notes
The mapping is pretty clear from the
nginx.conf
file in the diff. Pick any code from the left and you should end-up with the code listed in the named section.You can test this by:
make services
http://localhost:9083/proxy/static/http://httpbin.org/status/<STATUS CODE HERE>
httpbin.org
page with the relevant status code, or your browser interpretation of the error