I solved this, the solution was to add "capture header host" in haproxy.cfg and get the host header info from stream->req_cap array.
[Carolina Gomes] PhD Student University of Toronto +1 (416) 931-4774 On Mon, Feb 15, 2016 at 2:58 PM, Carolina Simões Gomes < carolina.sgo...@gmail.com> wrote: > 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 > >