HAProxy community

Cant redirect http to http. Also network error when using http2


I have been testing haproxy and saw two issues.

First when I open site it doesnt redirect traffic to https.

Second, When I enable http2 mozilla browser shows network error and chrome error in ssl.


FrontEnd Configuration

frontend main
bind *:80
option http-server-close
option forwardfor

acl letsencrypt-acl path_beg /.well-known/acme-challenge/
use_backend letsencrypt-backend if letsencrypt-acl

#bind *:443 ssl crt /etc/letsencrypt/live/web.bullten.work/web.bullten.work.pem alpn h2,http/1.1 #combine letsencrypt cert.pem and private.pem file
bind *:443 ssl crt /etc/letsencrypt/live/web.bullten.work/web.bullten.work.pem

http-request redirect scheme https code 301 if ! letsencrypt-acl

default_backend app-main

LE Backend

backend letsencrypt-backend
server letsencrypt


BackEnd roundrobin as balance algorithm

backend app-main
balance roundrobin #Balance algorithm
option httpchk HEAD / HTTP/1.1\r\nHost:\ localhost #Check the server application is up and healty - 200 status code
server nginx1 check ssl verify none #Nginx1
server nginx2 check ssl verify none #Nginx2
server nginx3 check ssl verify none #Nginx3

listen stats

HAProxy stats web gui.

    bind      :9000
    mode http
    stats enable
    stats uri /haproxy_stats
    stats realm HAProxy Statistics
    stats auth haproxy:haproxy
    stats admin if TRUE

http to https redirection issue solved. http2 issue is left

all issues solved… thanks