# Proxy Protocol: configuration and output examples

This section provides information about enabling Proxy Protocol support in your `network()` source options, and an example configuration and output to illustrate how the Proxy Protocol method works in AxoSyslog.

For more information about the working mechanism of the Proxy Protocol, see [The working mechanism behind the Proxy Protocol](../../../../docs/axosyslog-core/4.26/chapter-sources/configuring-sources-network/proxy-prot-intro/proxy-prot-w-mech/index.md).

## Enabling Proxy Protocol support for your network() source options

Unless you enable Proxy Protocol support for your `network()` source, AxoSyslog identifies every connection that is connected to the load balancers identically by default, regardless of the source IP or the source protocol.

To enable Proxy Protocol for your `network()` source, set [the `transport()` parameter of your `network()` source](../../../../docs/axosyslog-core/4.26/chapter-sources/configuring-sources-network/reference-source-network/index.md#transport) to `proxied-tcp`, `proxied-tls-passthrough`, or `proxied-udp`, depending on your preference and configuration.

`proxied-tls` can be used in complex MITM (man in the middle) configurations, where the proxy header is sent encrypted within the same TLS session as the proxied messages.

When you enable Proxy Protocol support for your `network()` source, you can use the following configuration example with your AxoSyslog application.

## Configuration

The following code sample illustrates how you can use the Proxy Protocol in your AxoSyslog configuration (using the `transport()` parameter set to `proxied-tls-passthrough`).

Terminal window
```
       @version: 3.35
        
        source s_tcp_pp {
          network (
            port(6666)
            transport("proxied-tls-passthrough")
            tls(
                key-file("/certs/certs/server/server.rsa")
                cert-file("/certs/certs/server/server.crt")
                ca-dir("/certs/certs/CA")
                peer-verify("required-trusted")
            )
          );
        };
        
        destination d_file {
          file("/var/log/proxy-proto.log" template("$(format-json --scope nv-pairs)\n"));
        };
        
        log {
          source(s_tcp_pp);
          destination(d_file);
        };
```

With this configuration, the Proxy Protocol method will perform injecting the information of the original connection into the forwarded TCP session, based on the working mechanism described in [The working mechanism behind the Proxy Protocol](../../../../docs/axosyslog-core/4.26/chapter-sources/configuring-sources-network/proxy-prot-intro/proxy-prot-w-mech/index.md).

The following example illustrates how the parsed macros will appear in the output.

## Example: Output for the PROXY TCP4 192.168.1.1 10.10.0.1 1111 2222 input header

With the `PROXY TCP4 192.168.1.1 10.10.0.1 1111 2222` input header, the output looks like this:

Terminal window
```
       {"SOURCE":"s_tcp_pp","PROXIED_SRCPORT":"1111","PROXIED_SRCIP":"192.168.1.1","PROXIED_IP_VERSION":"4","PROXIED_DSTPORT":"2222","PROXIED_DSTIP":"10.10.0.1","PROGRAM":"TestMsg","MESSAGE":"","LEGACY_MSGHDR":"TestMsg","HOST_FROM":"localhost","HOST":"localhost"}
```

Note that the [macros](../../../../docs/axosyslog-core/4.26/chapter-sources/configuring-sources-network/proxy-prot-intro/proxy-prot-w-mech/index.md#proxy-prot-adds-macros) that AxoSyslog adds to the message appear in the output.

## Enabling Proxy Protocol v2 support over UDP

Available in AxoSyslog version 4.25 and later.

To receive UDP syslog messages from a load balancer that injects HAProxy Proxy Protocol v2 headers, set `transport("proxied-udp")` on your `network()` or `syslog()` source.

Note `proxied-udp` supports HAProxy Proxy Protocol **version 2** only. Proxy Protocol v1 is not supported over UDP. 

Using the `network()` driver (BSD syslog/RFC3164 format):

Terminal window
```
    source s_udp_pp {
        network(
            ip("0.0.0.0")
            port(514)
            transport("proxied-udp")
        );
    };
```

Using the `syslog()` driver (IETF syslog/RFC5424 format):

Terminal window
```
    source s_syslog_udp_pp {
        syslog(
            ip("0.0.0.0")
            port(514)
            transport("proxied-udp")
        );
    };
```

After parsing, the original client address and port are available as `${SOURCEIP}`, `${SOURCEPORT}`, `${DESTIP}`, and `${DESTPORT}` macros, the same as for TCP-based proxied transports.

Last modified April 15, 2026: [[4.25] Document HAProxy UDP support (297d9218)](<https://github.com/axoflow/axosyslog-core-docs/commit/297d9218db93bf63bc50c1873646233ab032895a>)