# HAProxy PROXY Protocol with TCP Tunnel

> Enable the HAProxy PROXY protocol on Pinggy TCP tunnels so the target web server receives the PROXY protocol header. Supports PROXY protocol v1 and v2 on all TCP connections.
> Source: https://pinggy.io/docs/tcp_tunnels/haproxy/


# HAProxy PROXY Protocol

When you forward traffic to an upstream TCP service, the connection arrives from Pinggy, so your service won't see the client's original IP address. The <a href="https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt" target="_blank">PROXY protocol</a> adds a header to connections to your upstream service, passing along connection details like the original client IP. You will need to configure your upstream service to handle the PROXY protocol header.

Pinggy supports the HAProxy PROXY protocol, where the target web server is an HAProxy server. It can be enabled via `x:haproxy[:v2]`. Pinggy supports both version 1 and version 2. As of now, it is applicable for all TCP connections, irrespective of tunnel type.

To enable HAProxy v1, use `x:haproxy` or `x:haproxy:v1`:


```bash
# SSH - no install, works anywhere the ssh client is available
ssh -p 443 -R0:localhost:8000 -t tcp@free.pinggy.io x:haproxy
```

```bash
# Pinggy CLI - install with: npm install -g pinggy (or download the binary)
./pinggy -p 443 -R0:localhost:8000 -t tcp@free.pinggy.io x:haproxy
```


To enable HAProxy v2, use `x:haproxy:v2`:


```bash
# SSH - no install, works anywhere the ssh client is available
ssh -p 443 -R0:localhost:8000 -t tcp@free.pinggy.io x:haproxy:v2
```

```bash
# Pinggy CLI - install with: npm install -g pinggy (or download the binary)
./pinggy -p 443 -R0:localhost:8000 -t tcp@free.pinggy.io x:haproxy:v2
```


