Skip to content

Conversation

MondayCha
Copy link

This PR resolves an issue where http.ErrAbortHandler panics are incorrectly logged as errors by the gin.Recovery middleware.

The current gin.Recovery middleware only handles "broken pipe" errors, causing it to log unnecessary stack traces when a client prematurely closes a connection. This behavior is misleading, as http.ErrAbortHandler is intentionally used by httputil.ReverseProxy to abort requests and is not a true application error.

This change modifies the Recovery middleware to explicitly check for http.ErrAbortHandler and suppress the logging of stack traces for this specific panic. This aligns the middleware with the intended behavior of the Go standard library and improves log clarity by filtering out expected panics.

Related Issue

References

Similar PRs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant