{"record":{"id":"f33d2b47498b8ce5","repo":"XTLS/Xray-core","slug":"malformed-proxy-host-host","errorCode":null,"errorMessage":"malformed proxy host: {host}","messagePattern":"malformed proxy host: (.+?)","errorType":"validation","errorClass":"errors.Error","httpStatus":null,"severity":"error","filePath":"proxy/http/server.go","lineNumber":150,"sourceCode":"\t\t}\n\t}\n\n\terrors.LogInfo(ctx, \"request to Method [\", request.Method, \"] Host [\", request.Host, \"] with URL [\", request.URL, \"]\")\n\tif err := conn.SetReadDeadline(time.Time{}); err != nil {\n\t\terrors.LogDebugInner(ctx, err, \"failed to clear read deadline\")\n\t}\n\n\tdefaultPort := net.Port(80)\n\tif strings.EqualFold(request.URL.Scheme, \"https\") {\n\t\tdefaultPort = net.Port(443)\n\t}\n\thost := request.Host\n\tif host == \"\" {\n\t\thost = request.URL.Host\n\t}\n\tdest, err := http_proto.ParseHost(host, defaultPort)\n\tif err != nil {\n\t\treturn errors.New(\"malformed proxy host: \", host).AtWarning().Base(err)\n\t}\n\tctx = log.ContextWithAccessMessage(ctx, &log.AccessMessage{\n\t\tFrom:   conn.RemoteAddr(),\n\t\tTo:     request.URL,\n\t\tStatus: log.AccessAccepted,\n\t\tReason: \"\",\n\t})\n\n\tif strings.EqualFold(request.Method, \"CONNECT\") {\n\t\treturn s.handleConnect(ctx, request, reader, conn, dest, dispatcher, inbound)\n\t}\n\n\tkeepAlive := (strings.TrimSpace(strings.ToLower(request.Header.Get(\"Proxy-Connection\"))) == \"keep-alive\")\n\n\terr = s.handlePlainHTTP(ctx, request, conn, dest, dispatcher)\n\tif err == errWaitAnother {\n\t\tif keepAlive {\n\t\t\tgoto Start","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/proxy/http/server.go#L132-L168","documentation":"Error \"malformed proxy host: {host}\" thrown in XTLS/Xray-core.","triggerScenarios":"Thrown at proxy/http/server.go:150 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}