Welcome! Log In Create A New Profile

Advanced

How to handle 500 Error on upstream itself, While Nginx handle other 5xx errors

ender ulusoy
July 07, 2017 09:42AM
We have a NGINX reverse proxy (clustered) with 45 upstreams (22 domains, 20
subdomains, 11 apps).

Some of our projects hosts apis for some users globally.

Our developers designed special custom 500 responses for special cases and
want to show that messages only for tomcat_api upstream.

They want to serve 500 pages and handle exceptions on tomcat_api upstream
members not on NGINX. But we want to handle all other 5xx errors on NGINX.

As I can not succeeded need a hand right now.

Here is the server configuration follows, could you please help?

Thank you.

server {
server_name api.hotcoldwarm.com;

location / {
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header x-redirect-uri hotcoldwarm;
add_header Strict-Transport-Security "max-age=31536000;
includeSubdomains; always";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://tomcat_api;
proxy_next_upstream error timeout http_502 http_503 http_504 http_404;
proxy_connect_timeout 1;
}
listen 80;
listen 443 ssl;
ssl_certificate /etc/rapidssl/live/api.hotcoldwarm.com/fullchain.pem;
ssl_certificate_key /etc/rapidssl/live/api.hotcoldwarm.com/privkey.pem;
include /etc/rapidssl/options-ssl-nginx.conf;
if ($scheme != "https") {
return 301 https://$host$request_uri;
}

}
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

How to handle 500 Error on upstream itself, While Nginx handle other 5xx errors

ender ulusoy July 07, 2017 09:42AM

Re: How to handle 500 Error on upstream itself, While Nginx handle other 5xx errors

Maxim Dounin July 10, 2017 08:20AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 194
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready