Khoi Nguyen Huu
Khoi Nguyen Huu

Reputation: 43

Redirect http to https haproxy use ssl passthrough

here is my configuration

frontend www-http

   bind *:80

option tcplog

  default_backend www-backend

mode tcp

frontend www-https

   bind *:443

   default_backend www-backend

option tcplog

mode tcp

backend www-backend

mode tcp

   server web1 192.168.1.191:443 check

   server web2 192.168.1.192:443 check backup

I want to when users types mysite.com >> https://mysites.com

I used redirect scheme https if !{ ssl_fc } on frontend as backend, but it cant reach my goal.

Upvotes: 3

Views: 10003

Answers (1)

NickAppletech
NickAppletech

Reputation: 31

It may be late, but the following works:

frontend LB
    bind :80 v4v6
    mode http
    redirect scheme https if !{ ssl_fc }

frontend LBS
    bind :443 v4v6
    option tcplog
    mode tcp
    default_backend LBB

backend LBB
    mode tcp
    balance roundrobin
    option ssl-hello-chk
    server srv1 server1.example.com:443 check
    server srv2 server2.example.com:443 check backup

Upvotes: 3

Related Questions