summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/caddyhttp/server.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/caddyhttp/server.go b/modules/caddyhttp/server.go
index d5be1e1..cff0f2e 100644
--- a/modules/caddyhttp/server.go
+++ b/modules/caddyhttp/server.go
@@ -247,6 +247,11 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
zap.String("msg", errMsg),
}, errFields...)
logger.Error("error handling handler error", errFields...)
+ if handlerErr, ok := err.(HandlerError); ok {
+ w.WriteHeader(handlerErr.StatusCode)
+ } else {
+ w.WriteHeader(http.StatusInternalServerError)
+ }
}
} else {
if errStatus >= 500 {