@marcel91200 / caddy Mirror · read-only / commits / a22c08a6
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 13, 15:30 UTC

caddyhttp: Fix for nil `handlerErr.Err` (#4977)

Francis Lavoie committed Aug 23, 2022 at 10:17 UTC a22c08a6385772861173f21ebab3ac0b63796402
1 file changed +5 -1
modules/caddyhttp/server.go
+5 -1
@@ -528,7 +528,11 @@ func (*HTTPErrorConfig) WithError(r *http.Request, err error) *http.Request {
528 repl.Set("http.error.status_text", http.StatusText(handlerErr.StatusCode))
529 repl.Set("http.error.id", handlerErr.ID)
530 repl.Set("http.error.trace", handlerErr.Trace)
531 - repl.Set("http.error.message", handlerErr.Err.Error())
531 + if handlerErr.Err != nil {
532 + repl.Set("http.error.message", handlerErr.Err.Error())
533 + } else {
534 + repl.Set("http.error.message", http.StatusText(handlerErr.StatusCode))
535 + }
536 }
537
538 return r