Skip to content

Commit

Permalink
caddyhttp: Return HTTP 421 for mismatched Host header (#4023)
Browse files Browse the repository at this point in the history
Potential fix for #4017 although the consensus is unclear.

Made change to return status code 421 instead of 403 when StrictSNIHost matching is on.
  • Loading branch information
rayjlinden committed Jan 12, 2022
1 parent af1ac9c commit 850e160
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/caddyhttp/server.go
Expand Up @@ -302,7 +302,7 @@ func (s *Server) enforcementHandler(w http.ResponseWriter, r *http.Request, next
err := fmt.Errorf("strict host matching: TLS ServerName (%s) and HTTP Host (%s) values differ",
r.TLS.ServerName, hostname)
r.Close = true
return Error(http.StatusForbidden, err)
return Error(http.StatusMisdirectedRequest, err)
}
}
return next.ServeHTTP(w, r)
Expand Down

0 comments on commit 850e160

Please sign in to comment.