I can add new header in haproxy with the "http response add-header" function and it's done successfully because i can see those added headers in my http packet when i use Wireshark.
The problem is i can't capture them. I use the "capture response header" function and with that i can capture and log common headers like "Content-Type" or "Connection" but it doesn't work for added headers.
this is my conf file haproxy.cfg :
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon
defaults
log global
mode http
option httplog
option dontlognull
option http-server-close
timeout http-request 5000
timeout connect 5000
timeout client 50000
timeout server 50000
frontend localnodes
bind 10.0.0.16:80
mode http
# Table definition
stick-table type ip size 100k expire 30s store conn_cur
tcp-request connection track-sc1 src
capture response header X-Test-One len 10
capture response header X-Test-Two len 10
capture response header Content-Type len 10
capture response header Connection len 10
default_backend nodes
backend nodes
mode http
balance roundrobin
http-response add-header X-Test-One %Ts
http-response add-header X-Test-Two %T
server web01 123.123.22.22:2222 check maxconn 500
listen stats *:1936
stats enable
stats uri /
stats hide-version
stats auth notthelogin:notthepassword
And when i make http request have this in my log file :
Oct 7 11:12:38 localhost haproxy[20304]: 10.0.0.20:34316 [07/Oct /2015:11:12:38.972] localnodes nodes/web01 0/0/0/1/1 200 11378 - - ---- 14/14/0/0/0 0/0 {||text/html|close} "GET / HTTP/1.0"
In the log we can clearly see with "{||text/html|close}" that standard header are well capture but not the 2 added headers which appears empty between the "|". But the are in the http packet as we can see with wireshark
Wireshark Screenshot showing custom headers
There is someone who can help me please ? I can't find out what is the problem and i'm on this since two days :/
Thank you :)