Quantcast
Channel: Serverphorums.com - HAProxy
Viewing all articles
Browse latest Browse all 5112

Truncated captured request headers (1 reply)

$
0
0
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}
```

The actual User-Agent header was:

```
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML,
like Gecko) Chrome/48.0.2564.109 Safari/537.36
```

If I changed the configuration to be:
```
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
capture request header User-Agent len 160
```

Then the captured log was correctly

```
{<redacted-host>|192.168.9.1|192.168.9.1|Mozilla/5.0 (Macintosh; Intel Mac
OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.109
Safari/537.36}
```

Is this a known issue/difference between `http-request capture` and
`capture request header`? Am I misusing them or doing something else wrong?
I'm running HA-Proxy version 1.6.3 2015/12/25.

Best regards,
Adam Renberg

Viewing all articles
Browse latest Browse all 5112

Trending Articles