@marcel91200 / caddy Mirror · read-only / commits / 850e1605
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 14, 00:15 UTC

caddyhttp: Return HTTP 421 for mismatched Host header (#4023)

Potential fix for #4017 although the consensus is unclear. Made change to return status code 421 instead of 403 when StrictSNIHost matching is on.

rayjlinden committed Jan 12, 2022 at 13:24 UTC 850e1605df140a0b52d7bd4c3a1c3567a67699e1
1 file changed +1 -1
modules/caddyhttp/server.go
+1 -1
@@ -302,7 +302,7 @@ func (s *Server) enforcementHandler(w http.ResponseWriter, r *http.Request, next
302 err := fmt.Errorf("strict host matching: TLS ServerName (%s) and HTTP Host (%s) values differ",
303 r.TLS.ServerName, hostname)
304 r.Close = true
305 - return Error(http.StatusForbidden, err)
305 + return Error(http.StatusMisdirectedRequest, err)
306 }
307 }
308 return next.ServeHTTP(w, r)