Hi.

Am 02.12.2019 um 09:27 schrieb JWD:
Hi,all
I want to write %[hdr_ip(X-Forwarded-For,-1)] to log, how to do that?
And how to log it with [if] confition? Like set-header below:
     http-request set-header X-Client-IP %[hdr_ip(X-Forwarded-For,-1)] if !{ 
hdr(X-Client-IP) -m found } { hdr(X-Forwarded-For) -m found }
     http-request set-header X-Client-IP %[src] if !{ hdr(X-Client-IP) -m found 
} !{ hdr(X-Forwarded-For) -m found }
Can anyone help me? Thanks.

You can capture request header via the following setup.
https://cbonte.github.io/haproxy-dconv/2.1/configuration.html#4-capture%20request%20header

For logging can you use this statement.

https://cbonte.github.io/haproxy-dconv/2.1/configuration.html#4.2-http-request%20set-log-level

JWD

Regards
Aleks

Reply via email to