kubernetes-ingress
kubernetes-ingress copied to clipboard
questions about request headers
Hi,
First: thanks for this great software!
I would like to log the full user-agent header. I do this with configmap options:
configmap:
log-format: '{"client_ip":"%ci","user-agent":"%[capture.req.hdr(1)]","ssl":"%sslv","method":"%HM","uri":"%[capture.req.uri]","protocol":"%HV","host":"%[capture.req.hdr(0)]","referer":"%[capture.req.hdr(2)]"},"status_code":%ST,"uploaded":%U,"read":%B}'
request-capture-len: '350'
request-capture: |
hdr(Host)
hdr(User-Agent)
hdr(Referer)
generated haproxy.conf:
log-format '{"client_ip":"%ci","user-agent":"%[capture.req.hdr(1)]","ssl":"%sslv","method":"%HM","uri":"%[capture.req.uri]","protocol":"%HV","host":"%[capture.req.hdr(0)]","referer":"%[capture.req.hdr(2)]"},"status_code":%ST,"uploaded":%U,"read":%B}'
http-request capture hdr(Host) len 350 if { var(txn.path_match) -m dom 7fbc2740058ffe79dd495e3c16d03446 }
http-request capture hdr(User-Agent) len 350 if { var(txn.path_match) -m dom 269cd81506887b83ad564f2c2e7fe98d }
http-request capture hdr(Referer) len 350 if { var(txn.path_match) -m dom cb21f8cb75d732d17f5fbfa7f5018847 }
I've tried to use capture.req.fhdr(1) ( see: https://github.com/haproxy/haproxy/issues/353 ) but I got "failed to parse log-format". Can somebody point to the documentation how can I do this in the right way?
HAProxy Ingress Controller v1.11.3
haproxy version is 2.8.7-1a82cdf