{"record":{"id":"c0cfe4ab53d15b15","repo":"nats-io/nats-server","slug":"timeout-reading-proxy-protocol-header","errorCode":null,"errorMessage":"timeout reading PROXY protocol header","messagePattern":"timeout reading PROXY protocol header","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/client_proxyproto.go","lineNumber":76,"sourceCode":"\n\t// Timeout for reading PROXY protocol header\n\tproxyProtoReadTimeout = 5 * time.Second\n)\n\n// PROXY protocol v1 constants\nconst (\n\tproxyProtoV1Prefix     = \"PROXY \"\n\tproxyProtoV1MaxLineLen = 107 // Maximum line length including CRLF\n\tproxyProtoV1TCP4       = \"TCP4\"\n\tproxyProtoV1TCP6       = \"TCP6\"\n\tproxyProtoV1Unknown    = \"UNKNOWN\"\n)\n\nvar (\n\t// Errors\n\terrProxyProtoInvalid      = errors.New(\"invalid PROXY protocol header\")\n\terrProxyProtoUnsupported  = errors.New(\"unsupported PROXY protocol feature\")\n\terrProxyProtoTimeout      = errors.New(\"timeout reading PROXY protocol header\")\n\terrProxyProtoUnrecognized = errors.New(\"unrecognized PROXY protocol format\")\n)\n\n// proxyProtoAddr contains the address information extracted from PROXY protocol header\ntype proxyProtoAddr struct {\n\tsrcIP   net.IP\n\tsrcPort uint16\n\tdstIP   net.IP\n\tdstPort uint16\n}\n\n// String implements net.Addr interface\nfunc (p *proxyProtoAddr) String() string {\n\treturn net.JoinHostPort(p.srcIP.String(), fmt.Sprintf(\"%d\", p.srcPort))\n}\n\n// Network implements net.Addr interface\nfunc (p *proxyProtoAddr) Network() string {","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/client_proxyproto.go#L58-L94","documentation":"The proxyProtoReadTimeout deadline (5 seconds) expired before the full PROXY protocol header arrived: the peer opened the connection but stalled mid-header. Returned unwrapped when io.ReadFull fails with a net.Error timeout.","triggerScenarios":"Thrown at server/client_proxyproto.go:76 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check network health/MTU between the PROXY sender and the server","Ensure the load balancer writes the header immediately after connect","Disable proxy protocol on the listener if the sender cannot be fixed"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3a66a489d262bf89b71a71c955c94920394532f3","analyzedAt":"2026-09-02T04:41:54.247Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}