HAProxy community

Redirect https to http 1.5.19


HA-Proxy version 1.5.19

I have 2 sites, one http and the other https. I have set redirects to make sure http requests are forwarded to the https site. The problem I have is that if the http is requested with https it shows an ssl error in the browser before leading to the https site. How to I redirect https requests for the http site to port 80?

Current config:

    maxconn 4096
    user haproxy
    group haproxy
    log local0 info  # emerg, alert, crit, err, warning, notice, info, debug

    mode http
    timeout connect 5000ms
    timeout client 50000ms
    timeout server 50000ms
        log     global
        option  dontlognull
        option  httplog
        option  http-server-close
    maxconn 2048

frontend http-in
        http-request del-header Proxy
        bind *:80 transparent
        rspadd X-Clacks-Overhead:\ GNU\ Terry\ Pratchett
        acl is_site1 hdr_end(host) -i www.mydomain.com mydomain.com
        acl is_site5 hdr_end(host) -i www.mydomain2.com mydomain2.com

        redirect prefix https://www.mydomain2.com if is_site5

        use_backend 104 if is_site1

frontend ssl_relay
        # this only works with 1.5 haproxy
        bind *:443
        mode tcp
        rspadd X-Clacks-Overhead:\ GNU\ Terry\ Pratchett
        option tcplog
        option socket-stats
        maxconn  2048

        tcp-request inspect-delay 5s
        tcp-request content accept if { req_ssl_hello_type 1 }

        use_backend 103 if { req_ssl_sni -i www.mydomain2.com }

backend 103
    mode tcp
        balance roundrobin
        option tcp-check
        option http-server-close
        timeout http-keep-alive 3000
        option tcplog
        hash-type consistent
    http-request del-header Proxy   
    server s103 verify none

backend 104       
    balance roundrobin
        option forwardfor
    http-request del-header Proxy
    server s104


With a “redirect prefix http://…” ?