DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 967,911 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Nandini Tayal
Nandini Tayal

Posted on

How to send a custom response when destination is down?

I am using Spring Cloud Gateway(Netty)

If the destination service is down the gateway throws *java.net.ConnectException: finishConnect(..) failed: Connection refused * and return a default response

Response returned -
{
"timestamp": "2022-09-30T10:45:15.593+00:00",
"path": "/myDestinationPath",
"status": 500,
"error": "Internal Server Error",
"requestId": "12345-6"
}

Is there any way to send a custom/decorated response instead of this default response?

Top comments (0)

🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.