HAProxy community

Redirect http to https

I have this setup: ubuntu with haproxy and let’s encrypt with many certificates, lxc containers with websites listening on port 80. If I browse using https everything works like a charm, but if I try with http they go in timeout, I would like they are redirected to https instead. Here is my haproxy configuration:

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

frontend web-ssl
bind *:443 ssl crt /etc/ssl/my.domain/my.domain.pem … and others certs
acl letsencrypt-acl path_beg /.well-known/acme-challenge/
use_backend letsencrypt-backend if letsencrypt-acl
acl mydomain hdr(host) -i my.domain
use_backend mydomain if mydomain

backend mydomain
mode http
redirect scheme https if !{ ssl_fc }
server mydomain

any help?
thanks a lot

If you see a timeout, you probably have some connection/network issues. Check firewall/iptables settings. Make sure you can actually reach port 80.