如何在 use_backend (Haproxy) 中使用 if 的多条件?
How to use multi-condition with if in use_backend (Haproxy)?
我正在使用 Haproxy 来分隔具有不同域设置的 http 和 https,
但是 http 的域限制效果不佳。我的设置如下。
有什么想法吗?
frontend ha_8080
mode tcp
bind *:8080
tcp-request content accept if { req_ssl_hello_type 1 }
tcp-request inspect-delay 100ms
tcp-request content accept if HTTP
acl is_using_ssl req.ssl_hello_type gt 0
acl is_abc hdr_dom(host) -i abc.com
use_backend http_server if !is_using_ssl is_abc #it works and only works on abc.com,
use_backend local_server1 if is_using_ssl is_abc #https will not working
use_backend local_server1 if is_using_ssl #it works, but I need it work only on abc.com
hdr_dom(host) 不适用于 https(ssl)。
我应该改为使用 req_ssl_sni。
我的最终设置如下。
frontend ha_8080
mode tcp
bind *:8080
tcp-request content accept if { req_ssl_hello_type 1 }
tcp-request inspect-delay 100ms
tcp-request content accept if HTTP
acl is_abc hdr_dom(host) -i abc.com
acl is_abc_ssl req_ssl_sni -i abc.com
use_backend http_server if is_abc
use_backend local_server1 if is_abc_ssl
我正在使用 Haproxy 来分隔具有不同域设置的 http 和 https, 但是 http 的域限制效果不佳。我的设置如下。 有什么想法吗?
frontend ha_8080
mode tcp
bind *:8080
tcp-request content accept if { req_ssl_hello_type 1 }
tcp-request inspect-delay 100ms
tcp-request content accept if HTTP
acl is_using_ssl req.ssl_hello_type gt 0
acl is_abc hdr_dom(host) -i abc.com
use_backend http_server if !is_using_ssl is_abc #it works and only works on abc.com,
use_backend local_server1 if is_using_ssl is_abc #https will not working
use_backend local_server1 if is_using_ssl #it works, but I need it work only on abc.com
hdr_dom(host) 不适用于 https(ssl)。
我应该改为使用 req_ssl_sni。
我的最终设置如下。
frontend ha_8080
mode tcp
bind *:8080
tcp-request content accept if { req_ssl_hello_type 1 }
tcp-request inspect-delay 100ms
tcp-request content accept if HTTP
acl is_abc hdr_dom(host) -i abc.com
acl is_abc_ssl req_ssl_sni -i abc.com
use_backend http_server if is_abc
use_backend local_server1 if is_abc_ssl