【问题标题】:haproxy acl not working in https/tcp modehaproxy acl 在 https/tcp 模式下不起作用
【发布时间】:2016-12-07 21:55:20
【问题描述】:

我遇到了一些问题,似乎我无法让 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 规则工作正常。

干杯

【问题讨论】:

    标签: haproxy


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

      为了使 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
      

      【讨论】:

        猜你喜欢
        • 2019-05-07
        • 1970-01-01
        • 2013-11-18
        • 2016-11-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多