How can I change kubernetes pod namespace dynamically in a backend
of HA proxy? Basically, what I need is the reference to the 2nd matched pattern group of reqrep
to be used as the namespace
in server
or extract the namespace from the Referer
, say if the referer is https://example.name.net/abc/app/v1, the namespace
should be abc
.
backend My_Web_Server
balance roundrobin
option forwardfor
http-request set-header X-Forwarded-Port %[dst_port]
http-request set-header X-Forwarded-Host %[req.hdr(Host)]
http-request add-header X-Forwarded-Proto https if { ssl_fc }
option httpchk HEAD / HTTP/1.1\r\nHost:localhost
acl fail-validation req.fhdr(X-Haproxy-ACL) -m found
http-request deny if fail-validation
reqrep ^([^\\ ]*)\\ (.*)/app/(.*) \\1\\ /app/\\3
server <server-name> <kubernetes-pod-name>.<namespace>:<port>