My haproxy instance serves 2 domains (mostly to avoid XSS on the main site).
The rules look something like this
bind :443 ssl crt /etc/ssl/haproxy.pem
acl is_static hdr_end(Host) -i example.com
acl is_api hdr_end(Host) -i api.example.com
acl is_files hdr_end(Host) -i example.io
redirect scheme https if !{ ssl_fc } is_static is_api
Now SSL uses /etc/ssl/haproxy.pem
as the default cert, which is the certificate for example.com
and not example.io
.
How can I specify certs for multiple domain names?
You can concatenate all your certificates into files say
haproxy1.pem
andhaproxy2.pem
or you can specify a directory containing all your pem files.As per the haproxy docs
Then on the config use something like this:
Read more about SNI
Keep in mind that SSL support is in development staging for haproxy and also that it apparently has considerable performance hit.
There are other solutions talked about in this thread: https://stackoverflow.com/questions/10684484/haproxy-with-multiple-https-sites
Hope this helps.
No need to concat or specify a list of certificates anymore, just specify a folder:
Note: make sure the folder isn't empty and valid PEM files are present, otherwise HAProxy will not run.
maybe you could check this too:
/etc/ssl/private/crt-list.txt:
haproxy.cfg:
refs: https://github.com/msimerson/Mail-Toaster-6/wiki/How-to-for-Multiple-Domain-SSL-Certificates-with-HaProxy