I have a Haproxy instance that rewrites Host
headers to internal ones using http-request set-header
.
http-request set-header Host internal.example
However, I'd still like backends to have access to the original Host
header. I think X-Forwarded-Host
is a good candidate for this, however I'm struggling to figure out how to do that.
I'm using this, which works:
capture request header Host len 64
http-request set-header X-Forwarded-Host %hrl
But of course that's a giant hack - won't work for more than 64 chars and won't work if I ever need to capture another header.
Is there a better way?