Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use gorilla/mux middleware to recover panics #313

Open
johnabass opened this issue May 17, 2022 · 0 comments
Open

Use gorilla/mux middleware to recover panics #313

johnabass opened this issue May 17, 2022 · 0 comments
Assignees

Comments

@johnabass
Copy link
Collaborator

Currently, any panic from HTTP handlers can cause the http.Server to stop processing requests. We can prevent this by adding a middleware to the *mux.Router that recovers any panic, logs it, and then returns a configurable status code. This will prevent issues like invalid UTF-8 from causing caduceus to stop accepting requests.

The recovery handler itself should probably go into github.com/xmidt-org/httpaux.

@denopink denopink self-assigned this Jun 23, 2022
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

No branches or pull requests

2 participants