I am beginner with haproxy and trying to do same basic redirection with haproxy
I have 2 sites
- www.test.com -> want to this to be redirected to https
- www.test.com/helpsub -> Should not redirect to https and remain on http
Is this possible ?
Best Regards,
W
Best Answer
Assuming you are using the 1.5 version of HAProxy.
To redirect to https can be done via the
redirect scheme
directive. This directive has an optional conditions list, so you could set up an ACL for this purpose.For instance to set up an acl to match the /helpsub path, you could have:
And to then do the redirect to https for everything, except the helpsub (and of course only when the connection is not yet via ssl) you could have:
The
!
sign meansnot matching
, so basically this reads as:Reference.