Skip to content

Instantly share code, notes, and snippets.

@taddev
Last active July 6, 2025 12:40
Show Gist options
  • Save taddev/6212449 to your computer and use it in GitHub Desktop.
Save taddev/6212449 to your computer and use it in GitHub Desktop.
Nginx Reverse Proxy with custom error if upstream proxy is not working.
server {
listen 80;
listen [::]:80 default server ipv6only=on;
location / {
proxy_intercept_errors on;
proxy_pass http://localhost:9000;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/errors;
}
}
@thisis2394
Copy link

Thanks for sharing

@warmos9
Copy link

warmos9 commented Jul 6, 2025

But this will also use the 50x.html when an upstream application responds such codes. Right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment