{"record":{"id":"4533c75812ce0355","repo":"nats-io/nats-server","slug":"unrecognized-proxy-protocol-format","errorCode":null,"errorMessage":"unrecognized PROXY protocol format","messagePattern":"unrecognized PROXY protocol format","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/client_proxyproto.go","lineNumber":77,"sourceCode":"\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 {\n\tif p.srcIP.To4() != nil {","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/client_proxyproto.go#L59-L95","documentation":"The first bytes on the connection match neither the PROXY v2 signature nor the 'PROXY ' v1 prefix, so the data is not PROXY protocol at all. The reader returns the consumed bytes so the caller can replay them into the next protocol layer instead of discarding them.","triggerScenarios":"Thrown at server/client_proxyproto.go:77 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Disable proxy protocol on the listener if clients connect directly","Verify the peer actually speaks PROXY protocol v1 or v2","Check that an intermediary is not mangling or stripping the header"],"exampleFix":null,"handlingStrategy":"fallback","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-08T10:18:20.063Z"}