Cluster peer forwarding fails when the HTTP listener has proxy_protocol enabled
Author: sjbarraza-qdrantCreated Sep 30, 2026Updated Sep 30, 2026
Version: 0.29.1 (same code on main at c2e7599)
Setup
- Two Warpgate replicas sharing one PostgreSQL database (native clustering), on Kubernetes,
POD_IPset. - AWS Network Load Balancer in front, not sticky, PROXY protocol v2 enabled on all target groups: TLS listener 443 → HTTP listener 8888, TCP 55432 → PostgreSQL listener, TCP 8443 → Kubernetes listener.
- Every listener sets
proxy_protocol: trueso Warpgate sees real client IPs (the TLS listener cannot preserve them otherwise).
What happens
A web login with TOTP enrolled regularly fails with Bad Gateway (reference: <id>). The login starts on one node and the next step (POST /@warpgate/api/auth/otp) lands on the other node, which forwards it to the owning node:
ERROR warpgate_common_http::errors: Request failed with an internal error correlation_id=<id> method=POST uri=/@warpgate/api/auth/otp error=error sending request for url (https://warpgate-cluster.internal:8888/@warpgate/api/auth/otp)
ERROR HTTP: ... url=/@warpgate/api/auth/state error=Error { source: Some(reqwest::Error { kind: Request, url: "https://warpgate-cluster.internal:8888/@warpgate/api/auth/state", source: hyper_util::client::legacy::Error(Connect, Custom { kind: Other, error: Os { code: 104, kind: ConnectionReset, message: "Connection reset by peer" } }) }) }About half of the logins fail (whenever consecutive steps land on different nodes); retrying until every step hits the same node works. Anything else that is forwarded to the owning node is affected the same way.
Cause
- Peers advertise
POD_IP:<http port>(advertised_peer_addressinwarpgate-core/src/cluster.rs) andpeer_requestconnects there with peer TLS, without a PROXY header. - With
proxy_protocol: true, the HTTP listener wraps its acceptor inMaybeProxyProtocolAcceptor, andread_header_inner(warpgate-common/src/helpers/proxy_protocol.rs) keeps reading until it can parse a PROXY v1/v2 header.Noneis only returned forLOCAL/UNKNOWNheaders, not for a connection without a header, so the peer's TLS ClientHello is rejected and the connection is reset. - So peer forwarding cannot work on any listener that has
proxy_protocolenabled, and the HTTP listener is the one peers use.
Why the usual workarounds do not apply
- Sticky sessions are not supported on NLB target groups behind a TLS listener, so the load balancer cannot keep a login on one node.
- The AWS Load Balancer Controller enables PROXY protocol for all target groups of a Service, so it cannot be turned off for the HTTP listener only; without it, every web client shows up with the load balancer's IP, which breaks login protection.
Expected
Cluster peer requests work with proxy_protocol: true.
Possible fixes
peer_requestsends a PROXY v2LOCALheader when the peer's HTTP listener hasproxy_protocolenabled (read_headeralready returnsNoneforLOCAL, so the listener side needs no change).- A dedicated peer listener (or peer port) without PROXY protocol, advertised instead of the HTTP port.
Option 1 looks like the smallest change. Happy to test a build or send a PR.
Source: warp-tech/warpgate