Voilà comment j'ai configuré mon serveur avec HAProxy pour avoir un serveur HTTPS et un serveur SSH sur le même port (et sur la même IP).
# this config needs haproxy-1.1.28 or haproxy-1.2.1
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
#log loghost local0 info
maxconn 4096
#chroot /usr/share/haproxy
user haproxy
group haproxy
daemon
#debug
#quiet
defaults
log global
# mode http
# option httplog
option dontlognull
retries 3
option redispatch
maxconn 2000
contimeout 5000
clitimeout 50000
srvtimeout 50000
timeout connect 5s
timeout server 20s
timeout client 50s
listen ssl PUBLIC_IP:443
tcp-request inspect-delay 2s
acl is_ssl req_ssl_ver 2:3.1
tcp-request content accept if is_ssl
use_backend ssh if !is_ssl
server www-ssl 127.0.0.1:443
timeout client 2h
option forwardfor
option httpclose
backend ssh
mode tcp
server ssh :22
timeout server 2h
Le serveur http écoute le port 443 seulement sur l'IP 127.0.0.1.
Source : https://dgl.cx/2010/01/haproxy-ssh-and-ssl-on-same-port