Score:0

How to use multiple SSL certificates in HA Proxy

cn flag

I currently have HA Proxy working with domain1.com, and am looking to add a domain2.com, I'm having a hard time finding documentation to support the adding of a second SSL certificate for SSL termination though, and was hoping for some assistance.

Current config:

frontend http-in:
    bind *:80
    redirect scheme https code 301 if !{ ssl_fc}

frontend https-in:
    bind *:443 ssl crt /etc/haproxy/certs/domain1.pem
    reqadd X-Forwarded-Proto:\ https
    acl letsencrypt-acl path_beg /.wellknown/acme-challenge/
    use_backend letsencrypt-backend if letsencrypt-acl

    acl domain1.com hdr_beg(host) -i domain1.com
    use_backend domain1.com if domain1.com

    acl demo.domain1.com hdr_beg(host) -i domain1.com
    use_backend domain1.com if domain1.com

Desired/attempted config:

frontend http-in:
    bind *:80
    redirect scheme https code 301 if !{ ssl_fc}

frontend https-in:
    bind *.domain1.com:443 ssl crt /etc/haproxy/certs/domain1.pem
    bind *.domain2.com:443 ssl crt /etc/haproxy/certs/domain2.pem
    reqadd X-Forwarded-Proto:\ https
    acl letsencrypt-acl path_beg /.wellknown/acme-challenge/
    use_backend letsencrypt-backend if letsencrypt-acl

    acl domain1.com hdr_beg(host) -i domain1.com
    use_backend domain1.com if domain1.com

    acl demo.domain1.com hdr_beg(host) -i domain1.com
    use_backend domain1.com if domain1.com

    acl domain2.com hdr_beg(host) -i domain2.com
    use_backend domain2.com if domain2.com

I'm sure I'm missing something, my attempted/desired config errors out generically telling me the config is wrong, so I'm sure there's a more correct way of going about this, help and suggestions much appreciated!

tilleyc avatar
us flag
https://serverfault.com/questions/560978/configure-multiple-ssl-certificates-in-haproxy
tilleyc avatar
us flag
Does this answer your question? [Configure multiple SSL certificates in Haproxy](https://serverfault.com/questions/560978/configure-multiple-ssl-certificates-in-haproxy)
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.