|
|
@ -181,10 +181,10 @@ func (c *WebSocketConfig) Build() (proto.Message, error) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
type HttpUpgradeConfig struct { |
|
|
|
type HttpUpgradeConfig struct { |
|
|
|
Path string `json:"path"` |
|
|
|
Path string `json:"path"` |
|
|
|
Host string `json:"host"` |
|
|
|
Host string `json:"host"` |
|
|
|
Headers map[string]string `json:"headers"` |
|
|
|
Headers map[string]string `json:"headers"` |
|
|
|
AcceptProxyProtocol bool `json:"acceptProxyProtocol"` |
|
|
|
AcceptProxyProtocol bool `json:"acceptProxyProtocol"` |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Build implements Buildable.
|
|
|
|
// Build implements Buildable.
|
|
|
@ -200,6 +200,14 @@ func (c *HttpUpgradeConfig) Build() (proto.Message, error) { |
|
|
|
path = u.String() |
|
|
|
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{ |
|
|
|
config := &httpupgrade.Config{ |
|
|
|
Path: path, |
|
|
|
Path: path, |
|
|
|
Host: c.Host, |
|
|
|
Host: c.Host, |
|
|
|