I have an nginx proxy pointing at an external server. When the external server is down, the nginx proxy returns a 502 bad gateway.

Instead, I'd like nginx to also refuse the connection - How can I do this?

1 Answer 1


After further thought, I think this can't be done. When nginx is making the request to the external server, it has already accepted the connection from the client

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.