lmenezes / cerebro

MIT License
5.53k stars 718 forks source link

Haproxy httpcheck returns 400 but curl is working fine #494

Open kalarikkalbabu opened 3 years ago

kalarikkalbabu commented 3 years ago

I am using HaProxy as LB(nginx as RP in front) to connect cerebro ,. used /cerebro/ as base path is I gave option httpcheck GET then always getting 400 bad request . but curl is working .If I remove httpcheck then application work like a charm, please help me on this

mrhackcz commented 3 years ago

Hi, try set Host header :)

option httpchk GET / HTTP/1.1
http-check send hdr Host domain.com
http-check expect status 200
server www1 10.0.0.10:9000 check
kalarikkalbabu commented 3 years ago

I have multiple server, then how can I give static Host header? This is working for all other application , I have only issue with Cerebro My config

backend cerebro cookie JSESSIONID prefix http-check disable-on-404 option httpchk HEAD /cerebro server server-host xxx.xxx.xxx.xx:8081 cookie server-host check server server-host1 xxx.xxx.xxx.xx:8081 cookie server-host1 check

kalarikkalbabu commented 3 years ago

Hello, Anyone have any idea on above issue?

mikelitka commented 3 years ago

Hello, Anyone have any idea on above issue?

You need to use an haproxy.map file.

https://www.haproxy.com/blog/how-to-map-domain-names-to-backend-server-pools-with-haproxy/