Browse Source

WebSocket config: Fix `headers` (#4177)

Fixes https://github.com/XTLS/Xray-core/issues/4176
珐琅彩山水佩奇童车游春马蹄杯 10 months ago
parent
commit
5836afc41f
1 changed files with 6 additions and 4 deletions
  1. 6 4
      infra/conf/transport_internet.go

+ 6 - 4
infra/conf/transport_internet.go

@@ -165,11 +165,13 @@ func (c *WebSocketConfig) Build() (proto.Message, error) {
 	}
 	// Priority (client): host > serverName > address
 	for k, v := range c.Headers {
-		errors.PrintDeprecatedFeatureWarning(`"host" in "headers"`, `independent "host"`)
-		if c.Host == "" {
-			c.Host = v
+		if strings.ToLower(k) == "host"{
+			errors.PrintDeprecatedFeatureWarning(`"host" in "headers"`, `independent "host"`)
+			if c.Host == "" {
+				c.Host = v
+			}
+			delete(c.Headers, k)
 		}
-		delete(c.Headers, k)
 	}
 	config := &websocket.Config{
 		Path:                path,