As of today, we log client ip in haproxy logs and manually ping it to identify the user. Is there a way we can print username in the logs by authentication or some other way?
try this:
- add proxy header:
curl -x "http://proxy.example.com:8080” “http://www.example.com” --proxy-user user:password
curl -x "http://user:password@proxy.example.com:8080” “http://www.example.com” - in your haproxy.cfg:
tcp-request content set-var(sess.proxyHeader) req.hdr(Proxy-Authorization),regsub(‘Basic ‘,’’,‘g’),ub64dec
log-format “proxyHeader: %[var(sess.proxyHeader)]”