Skip to content

Commit 0f9bced

Browse files
AdamEr8danderson
authored andcommitted
Fixed HAProxy's PROXY protocol v1 Human-readable header format in DialProxy
original code sent the header in the format: PROXY <family> <srcIP> <srcPort> <dstIP> <dstPort> according to docs header format should be: PROXY <family> <srcIP> <dstIP> <srcPort> <dstPort> this is according to: https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt section 2.1. Human-readable header format (Version 1).
1 parent 2825d76 commit 0f9bced

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tcpproxy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ func (dp *DialProxy) sendProxyHeader(w io.Writer, src net.Conn) error {
411411
if srcAddr.IP.To4() == nil {
412412
family = "TCP6"
413413
}
414-
_, err := fmt.Fprintf(w, "PROXY %s %s %d %s %d\r\n", family, srcAddr.IP, srcAddr.Port, dstAddr.IP, dstAddr.Port)
414+
_, err := fmt.Fprintf(w, "PROXY %s %s %s %d %d\r\n", family, srcAddr.IP, dstAddr.IP, srcAddr.Port, dstAddr.Port)
415415
return err
416416
default:
417417
return fmt.Errorf("PROXY protocol version %d not supported", dp.ProxyProtocolVersion)

0 commit comments

Comments
 (0)