title: Haproxy Https and Vhost
body: <p>I am new to the Haproxy world and after many hours I have managed to work with certificate and in https mode. But now I have a new problem that seems to be due to Vhost on the target servers.</p>
  <p>I read that you need to create a rule to point to the vhost, when it goes through the domain instead of loading the web, the default page of the server appears, as it loads the IP instead of the domain.</p>
  <p>Can you give me an example?</p>
  <pre><code>    frontend www-https
      bind www.dominio.dev:443 ssl crt /etc/letsencrypt/live/sddd.net/1.pem
      mode http
      stats enable
      stats auth  cda:cda
      balance roundrobin
  
      option http-server-close
      option forwardfor
      http-request add-header X-Forwarded-Proto https
      http-request add-header X-Forwarded-Port 443
      http-response add-header Strict-Transport-Security max-age=15768000
  
      acl letsencrypt-acl path_beg /.well-known/acme-challenge/
    # use_backend letsencrypt-backend if letsencrypt-acl
      http-request redirect scheme https unless { ssl_fc }
      default_backend www-backend
  
  
  backend www-backend
     redirect scheme https if !{ ssl_fc }
     #http-request redirect scheme https if http
     server www-1 www1.dominio.dev:443 ssl verify none
     server www-2 www2.dominio.dev:443 ssl verify none maxconn 5000
     server www-3 www3.dominio.dev:443 ssl verify none
  </code></pre>