-
I'm using Yarp to upgrade my .Net Framework MVC application to .Net 6. I'm experienced with .Net Framework, but new to .Net 6. My application currently calls UseExceptionHandler in Program.cs, and this generally works well for us as we can examine the exception and decide what we want to log and what we want to display to the user. However, when my .Net Framework app is not responding, it doesn't get caught by the exception handler. Instead I get a blank HTTP 502 response. #471 suggests using StatusCodePages but if I do that it overrides my exception handler. How should I handle Yarp errors in an application that already calls UseExceptionHandler? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
YARP does not throw exceptions for issues with external entities, it sets a 5xx response and adds additional info to the HttpContext. You can inspect that info to generate a custom response. See: https://microsoft.github.io/reverse-proxy/articles/middleware.html#error-handling |
Beta Was this translation helpful? Give feedback.
YARP does not throw exceptions for issues with external entities, it sets a 5xx response and adds additional info to the HttpContext. You can inspect that info to generate a custom response. See: https://microsoft.github.io/reverse-proxy/articles/middleware.html#error-handling