Skip to content

Commit eac02ee

Browse files
committed
caddyhttp: Limit empty Host check to HTTP/1.1
1 parent 72eaf25 commit eac02ee

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

modules/caddyhttp/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ func (s *Server) serveHTTP(w http.ResponseWriter, r *http.Request) error {
486486
// code to any HTTP/1.1 request message that lacks a Host header field and to any
487487
// request message that contains more than one Host header field line or a Host
488488
// header field with an invalid field value."
489-
if r.Host == "" {
489+
if r.ProtoMajor == 1 && r.ProtoMinor == 1 && r.Host == "" {
490490
return HandlerError{
491491
Err: errors.New("rfc9112 forbids empty Host"),
492492
StatusCode: http.StatusBadRequest,

0 commit comments

Comments
 (0)