Skip to content

Use gorilla/mux middleware to recover panics #313

Description

@johnabass

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions