我正在尝试重定向 haproxy.cfg 文件中的 URL,但不知道从哪里开始。我的目标是每当我访问https://网站/文本它被重定向到https://website/#/text/conversation语音也是一样。我该怎么做?我使用的是 HAProxy 版本 1.5.14。下面是我尝试过的,但它并没有像我想要的那样工作。
frontend HTTPS_IN
acl host_connect hdr(host) -i website.com
acl path_voice path_beg -i /voice
redirect location https://website/#/voice/voicemail if path_voice
acl path_text path_beg -i /text
redirect location https://website/#/text/conversation if path_text
use_backend voice if path_voice
use backend voice if host_connect
use_backend text if path_text
我走的路对吗?如果不是,你们能帮帮我吗?
谢谢!
答案1
看起来您设置了 host_connect acl 以连接到 website.com。稍后不会发生任何变化,因此它将始终匹配,use backend voice if host_connect
因此我预计您最终将始终位于语音后端。
尝试这样做:
frontend HTTPS_IN
acl path_voice path_beg -i /voice
redirect location https://website/#/voice/voicemail if path_voice
acl path_text path_beg -i /text
redirect location https://website/#/text/conversation if path_text
use_backend voice unless path_text