问题原文
原帖链接 · user305414 · CC BY-SA 3.0
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
已采纳解答
原帖链接 · Mick Switser · CC BY-SA 4.0
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:
acl helpsub path_beg /helpsub
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:
redirect scheme https if !{ ssl_fc } !helpsub
The ! sign means not matching, so basically this reads as:
redirect the request to the https scheme, if you are not on an ssl connection and the path does not start with /helpsub.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
