I\'m using HAProxy for load balancing and only want my site to support https. Thus, I\'d like to redirect all requests on port 80 to port 443.
How would I do this?<
redirect statement is legacy
use http-request redirect instead
acl http ssl_fc,not
http-request redirect scheme https if http
acl host-example hdr(host) -i www.example.com
# for everything not https
http-request redirect scheme https code 301 unless { ssl_fc }
# for anything matching acl
http-request redirect scheme https code 301 if host-example !{ ssl_fc }
Simply:
frontend incoming_requsts
bind *:80
bind *:443 ssl crt *path_to_cert*.**pem**
**http-request redirect scheme https unless { ssl_fc }**
default_backend k8s_nodes
Can be done like this -
frontend http-in
bind *:80
mode http
redirect scheme https code 301
Any traffic hitting http will redirect to https