Quantcast
Channel: Serverphorums.com - HAProxy
Viewing all articles
Browse latest Browse all 5112

How to pass “Host” header from client request to backend server (no replies)

$
0
0
Hello,

First-timer on the mailing list :-) Below is my question.

I created a custom HAProxy load balancing code, that instead of using one
of the default algorithms such as round robin, calls a webservice that
decides which server to route to. I call from haproxy C code to the
webservice using libcurl. That part works. However, I would like to send
the "host" header from the client request that reaches HAProxy to this
webservice, as a query parameter. But I am not sure how to get the host
header from the client request!

I tried using methods like "find_http_header2("Host", 4, ...)" and
variants, as seen in proto_http.c usages. But the Host header never seems
to be found, only other headers such as Content-Length, Connection etc.From
my browser (Firefox), I used the debugger and the GET http request sent by
the browser does have the Host header, so not sure why HAProxy doesn't
receive it.

I am currently using a "listen" configuration but even if I separate in
frontend and backend configurations on haproxy.cfg, the issue is still the
same. Any ideas?

Thanks,
[Carolina Gomes]
PhD Student
University of Toronto
+1 (416) 931-4774

Viewing all articles
Browse latest Browse all 5112

Trending Articles