haproxy - HAProxy 上子域和通配符域的特定路由
问题描述
我怎样才能实现特定子域的正确路由,然后路由与任何以前的 ACLS 不匹配的任何域?
frontend web_dashs
mode http
bind *:443 ssl crt /etc/ssl/domain/
http-request add-header X-Forwarded-Proto https
redirect scheme https if !{ ssl_fc }
acl domain_a hdr_sub(host) -i a.domain.com
acl domain_b hdr_sub(host) -i b.domain.com
acl wilds hdr(host) -i
# Default Route to normal backends
use_backend backend_a if domain_a
use_backend backend_b if domain_b
use_backend backend_c if wilds
基本上,我想做的基本上是:
一个。----> 后端 A b。----> 后端 B *.-----> 后端 C
提前致谢。
解决方案
匹配其余部分不需要 ACL,只需使用 default_backend:
frontend web_dashs
mode http
bind *:443 ssl crt /etc/ssl/domain/
http-request add-header X-Forwarded-Proto https
redirect scheme https if !{ ssl_fc }
acl domain_a hdr_sub(host) -i a.domain.com
acl domain_b hdr_sub(host) -i b.domain.com
use_backend backend_a if domain_a
use_backend backend_b if domain_b
default_backend backend_c
推荐阅读
- hibernate - 当@ManytoOne 是拥有方时,有没有办法使用@OrderColumn?
- python - 如何在 BeautifulSoup 中进行身份验证?需要验证是输出
- laravel - Laravel 信封 MIX_VAR 显示错误值
- reactjs - FilePond 仅接受 pdf 文件
- python-3.x - 从雅虎财经的字符串中解析日期时间
- javascript - 如何解决茉莉花错误“加载时出错:脚本错误。” 什么时候使用jquery?
- javascript - 如何使用函数在反应中插入重复
- wordpress - 精选图片未出现
- reactjs - 每当 React Formik 发生错误时更改现有输入字段的样式
- r - 在 MacOS 上从 R 运行 psql : sh: psql: command not found