Forward requests to cpanel server through haproxy

I deployed an loadbalanced infrustructure. I am using haproxy as the loadbalancer and cpanel as backend webservers. I created a test host on the cpanel, and I can see the site in browser when I configure the website in my /etc/host with the cpanel server ip address. But when I change the ip to the loadbalancer it forwards the requests to /usr/local/apache/htdocs/ and I get the default cpanel server page(defaultwebpage.cgi). What configurations should I use in haproxy to redirects requests correctly? Any help is appreciated.

Haproxy just forwards HTTP requests transparently by default (unless you configure something specific to NOT do that).

Check haproxy configuration, and check apache configuration. Is the host header the deciding factor vor vhost selection? Any special handling based on the source IP.

Like I said, haproxy doesn’t change the HTTP request unless explicitly configured to do so.

I’ve run into this same issue. Did you ever resolve the problem?