haproxy acl 无法在 https/tcp 模式下工作

发布于 2024-09-27 22:25:13 字数 964 浏览 0 评论 0原文

我遇到了一些问题,似乎我无法让 acl 在 tcp 模式下工作,
一切都在 http 模式下工作。
这是我的配置。

frontend  http *:80
    acl http_test_acl       path_beg    -i /test
    use_backend http_test   if http_test_acl
    default_backend         http_default

backend http_test
    balance   roundrobin
    server    httptest 10.10.10.10:80 check

backend http_default
    balance   roundrobin
    server    httpdefault 10.10.10.10:80 check

############# HTTPS #################
frontend  https *:443
    mode tcp
    acl https_test_acl         path_beg -i /test
    use_backend https_test     if https_test_acl
    default_backend            https_default

backend https_test
    mode tcp
    balance   roundrobin
    server    httpstest 10.10.10.10:443 check

backend https_default
    mode tcp
    balance   roundrobin
    server    httpsdefault 10.10.10.10:443 check

不要关注ip 10.10.10.10,因为我已经隐藏了我原来的ip。您能否让我知道为什么 https 不起作用,http 前端/后端 acl 规则工作得很好。

干杯

I am experiencing some problems, it seems I can't get acl's to work in tcp mode,
everything works in http mode.
Here is my config.

frontend  http *:80
    acl http_test_acl       path_beg    -i /test
    use_backend http_test   if http_test_acl
    default_backend         http_default

backend http_test
    balance   roundrobin
    server    httptest 10.10.10.10:80 check

backend http_default
    balance   roundrobin
    server    httpdefault 10.10.10.10:80 check

############# HTTPS #################
frontend  https *:443
    mode tcp
    acl https_test_acl         path_beg -i /test
    use_backend https_test     if https_test_acl
    default_backend            https_default

backend https_test
    mode tcp
    balance   roundrobin
    server    httpstest 10.10.10.10:443 check

backend https_default
    mode tcp
    balance   roundrobin
    server    httpsdefault 10.10.10.10:443 check

Don't pay attention to ip 10.10.10.10 as I have hidden my orginal one. Could you please let me know why https is not working, http frontend/backend acl rules are working just fine.

cheers

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

ヤ经典坏疍 2024-10-04 22:25:13

因为您的 https 服务器处于 tcp 模式(因为它们应该用于 ssl),所以第 7 层规则不起作用。

Cause your https servers are in tcp mode (as they should be for ssl), so a layer 7 rule wont work.

浅忆 2024-10-04 22:25:13

要使 ACL 正常工作,请禁用 tcp 模式,然后在后端服务器上设置 ssl(因此使用 ssl 关键字)。

frontend  https *:443
    acl https_test_acl      path_beg    -i /test
    use_backend     https_test  if https_test_acl
    default_backend             https_default

backend https_test
    balance   roundrobin
    server    httpstest 10.10.10.10:443 ssl check

backend https_default
    balance     roundrobin
    server  httpsdefault 10.10.10.10:443 ssl check

或者,不必在两台后端服务器上设置 ssl;在后端服务器中使用私有 IPS 并确保后端服务器上的端口不对外界开放

    backend https_test
    balance   roundrobin
    server    httpstest some_private_ip:8000 check

for acl to work, disable tcp mode then set up ssl on the servers on your backend(hence the ssl keyword)

frontend  https *:443
    acl https_test_acl      path_beg    -i /test
    use_backend     https_test  if https_test_acl
    default_backend             https_default

backend https_test
    balance   roundrobin
    server    httpstest 10.10.10.10:443 ssl check

backend https_default
    balance     roundrobin
    server  httpsdefault 10.10.10.10:443 ssl check

Alternatively instead of having to setup ssl on both your backend servers; use private IPS in the backend servers and make sure ports on the backend servers arent open to the world

    backend https_test
    balance   roundrobin
    server    httpstest some_private_ip:8000 check
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文