Quantcast
Channel: HAProxy community - Latest topics
Viewing all articles
Browse latest Browse all 4849

Force http to https

$
0
0

@zahid.k11 wrote:

Hi Team,

I'm trying to force https on my test website. I have the following config "haproxy > Nginx > Tomcat". However whenever I add "redirect scheme https if !{ ssl_fc }" to force https my login stops. Currently, both http and https are working well individually. The following is my configuration. I have separate frontend & backend for http and https. Not sure where I am going wrong. Please help!!

frontend http-test-80
bind 192.168.1.10:80
mode http
reqadd X-Forwarded-Proto:\ http

    redirect scheme https if !{ ssl_fc }

    acl host_test80 hdr(host) -i test.zahid.com
    use_backend static_test if host_test80

    acl host_test80 hdr(host) -i static1.test.zahid.com
    use_backend static_test if host_test80

backend static_test
balance roundrobin
option httpclose
option forwardfor
cookie static insert indirect nocache
option httpchk HEAD /LoadBalancer_HealthCheck.php HTTP/1.0
server stat-test 192.168.1.20:80 cookie mpstatic1 check

=================================================================================
frontend http-test-443
bind 192.168.1.10:443 ssl crt /etc/haproxy/certs/test.zahid.com/test.zahid.com.pem
reqadd X-Forwarded-Proto:\ https

    acl host_test443_secure hdr(host) -i test.zahid.com
    use_backend static_test_secure if host_test443_secure

    acl host_test443_secure hdr(host) -i static1.test.zahid.com
    use_backend static_test_secure if host_test443_secure

backend static_test_secure
balance roundrobin
option httpclose
option forwardfor
redirect scheme https if !{ ssl_fc }
cookie static insert indirect nocache
option httpchk HEAD /LoadBalancer_HealthCheck.php HTTP/1.0
server stat-test-secure 192.168.1.20:80 cookie mpstatic2 check

Best Regards,
Zahid

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4849

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>