Detect and drop broken conns in the fastproxy pool
Co-authored-by: Romain <rtribotte@users.noreply.github.com>
This commit is contained in:
parent
b22e081c7c
commit
e3ed52ba7c
7 changed files with 426 additions and 280 deletions
|
@ -102,9 +102,14 @@ func isWebSocketUpgrade(req *http.Request) bool {
|
|||
|
||||
// ErrorHandler is the http.Handler called when something goes wrong when forwarding the request.
|
||||
func ErrorHandler(w http.ResponseWriter, req *http.Request, err error) {
|
||||
ErrorHandlerWithContext(req.Context(), w, err)
|
||||
}
|
||||
|
||||
// ErrorHandlerWithContext is the http.Handler called when something goes wrong when forwarding the request.
|
||||
func ErrorHandlerWithContext(ctx context.Context, w http.ResponseWriter, err error) {
|
||||
statusCode := ComputeStatusCode(err)
|
||||
|
||||
logger := log.Ctx(req.Context())
|
||||
logger := log.Ctx(ctx)
|
||||
logger.Debug().Err(err).Msgf("%d %s", statusCode, statusText(statusCode))
|
||||
|
||||
w.WriteHeader(statusCode)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue