Browse Source

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.
master
rayjlinden 3 years ago
committed by GitHub
parent
commit
850e1605df
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      modules/caddyhttp/server.go

2
modules/caddyhttp/server.go

@ -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)

Loading…
Cancel
Save