Can haproxy log unknown headers

haproxylogging

I need to take a look at all the headers of certain requests. I've been reading the haproxy manual, I am able to use capture to log whatever header I KNOW is there.

But I would like to see ALL the headers, unknown to me, that the app receives. Is this possible with haproxy's logging options? Some sort of regexp or iteration method?

I am using haproxy 1.6

Thank you.

Best Answer

Try to use (in /etc/haproxy/haproxy.cfg):

frontend my_frontend
  mode http
  option httplog
  http-request capture req.hdrs len 512
  log-format "%ci:%cp [%tr] %ft [[%hr]] %hs %{+Q}r"

req.hdrs - Returns the current request headers as string including the last empty line separating headers from the request body
%hr - print captured request headers

Hope this helps.