miekg / caddy-prometheus

Prometheus metrics middleware for caddy
Apache License 2.0
65 stars 26 forks source link

Transparently capture the status code from other plugins #28

Closed jaredririe closed 7 years ago

jaredririe commented 7 years ago

Fixes #27

This change ensures that the Prometheus plugin does not side effect other plugins which interpret the status code returned from ServeHTTP in various ways. For example, some plugins, like errors (caddy/caddyhttp/errors/errors.go), interpret status code 0 as an already-written response. If the proxy plugin returns 0 and this plugin changes the status code to something other than 0, unexpected behavior can result.

miekg commented 7 years ago

Nice. Thank you

miekg commented 7 years ago

After fixing the tests (and some go vet issue) a new version is deployed on the Caddy website. Enjoy and thanks for the help!