ssl - 如何在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
推荐阅读
- django - Django 使用表单更新布尔字段
- netsuite - 在启用没有空字段选项的库存状态后,我想在 NetSuite 中制作一个带有状态列表的自定义表单
- c++ - 如何在 Makefile 中重用目标?
- kubernetes - Kubectl 服务器版本未升级
- python - 如何检查列表列表中是否存在列表列表?
- windows - 为什么 Windows 将名称中带有“SETUP”的 VB6 EXE 标记为以管理员身份运行?
- wpf - 获取 DataTrigger 以更改属性的问题
- qt - 为什么 fbo 不能在 macOS 上生成正确大小的纹理?
- jquery - jQuery下拉菜单不出现
- windows - 在 Windows 7 上添加路由到 VPN