Hi Adam,

Le 18/02/2016 11:54, Adam Renberg a écrit :
Hi,

Today I updated our HAProxy config to capture more request headers into
the logs. I added the following configuration to our frontends:

```
http-request capture hdr(Host) len 40
http-request capture hdr(X-Real-IP) len 15
http-request capture hdr(X-Forwarded-For) len 100
http-request capture hdr(User-Agent) len 160
```

I elected to use `http-request capture` and not `capture request header`
because the latter didn't seem to be able to capture request headers
that we generate from the same HAProxy frontend. Is this a known issue?

Anyway, with this setup, something weird happened with the captured
User-Agent header. It is truncated. The captured request header part of
the logs looked like this:

```
{<redacted-host>|192.168.9.1|192.168.9.1|like Gecko)
Chrome/48.0.2564.109 Safari/537.36}
```

Indeed, you should use req.fhdr() [1] instead, to capture the whole line, otherwise the comma is interpreted as a delimiter to distinguish values.

Note that this is explained in the documentation [2] ;-)

[1] http://cbonte.github.io/haproxy-dconv/configuration-1.5.html#7.3.6-req.fhdr [2] http://cbonte.github.io/haproxy-dconv/configuration-1.5.html#7.3.6-req.hdr

--
Cyril Bonté

Reply via email to