Skip to content

Commit

Permalink
Fix host in headers field does not work #3191
Browse files Browse the repository at this point in the history
  • Loading branch information
Fangliding committed Mar 27, 2024
1 parent e2439c0 commit 7d4c176
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions infra/conf/transport_internet.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,14 @@ func (c *HttpUpgradeConfig) Build() (proto.Message, error) {
path = u.String()
}
}
// If http host is not set in the Host field, but in headers field, we add it to Host Field here.
// If we don't do that, http host will be overwritten as address.
// Host priority: Host field > headers field > address.
if c.Host == "" && c.Headers["host"] != "" {
c.Host = c.Headers["host"]
} else if c.Host == "" && c.Headers["Host"] != "" {
c.Host = c.Headers["Host"]
}
config := &httpupgrade.Config{
Path: path,
Host: c.Host,
Expand Down

0 comments on commit 7d4c176

Please sign in to comment.