One port to catch HTTP and HTTPS requests and redirect to the HTTPS version

Use a TCP frontend to differentiate between HTTP and SSL traffic, than recirculate the traffic to proper HTTP or HTTPS frontends.

Something like:

frontend port801_combined
    mode tcp
    bind :801
    tcp-request inspect-delay 2s
    tcp-request content accept if HTTP
    tcp-request content accept if { req.ssl_hello_type 1 }
    use_backend recir_http if HTTP
    default_backend recir_https

backend recir_http
    mode tcp
    server loopback-for-http abns@haproxy-http send-proxy-v2
backend recir_https
    mode tcp
    server loopback-for-https abns@haproxy-https send-proxy-v2

frontend fe-https
    mode http
    bind abns@haproxy-https accept-proxy ssl crt /etc/ssl/private/unified-cert-file.pem
    # whatever you need todo for HTTPS traffic
frontend fe-http
    mode http
    bind abns@haproxy-http accept-proxy
    # whatever you need todo for HTTP traffic
4 Likes