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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .