HAProxy - Redirect traffic of one domain to https and other domains to http only
<p>I am using dedicated servers to host 4 domains and 3 subdomains on Centos &amp; WHM. Recently planned to use HAProxy for load balancing between them.</p>

<p>What I am trying to achieve is to redirect all the traffic of one particular domain to https using HAProxy configuration on frontend because I am terminating the SSL of that one particular domain at HAProxy.</p>

<p>here's what i have used</p>

<pre><code>frontend www-https
    bind haproxy_www_public_IP:443 ssl crt /etc/ssl/private/example.com.pem
    reqadd X-Forwarded-Proto:\ https
    default_backend www-backend


backend www-backend
    redirect scheme https if !{ ssl_fc }
    server www-1 www_1_private_IP:80 check
    server www-2 www_2_private_IP:80 check
</code></pre>

<p>I have googled for solution but most of the solution available are telling to redirect all the traffic to https or http.</p>