HAProxy上的子域和通配符域的特定路由

问题描述 投票:0回答:1

如何实现特定子域的正确路由,然后路由与任何以前的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。 ---->后端Ab。 ---->后端B* .----->后端C

提前感谢。

haproxy
1个回答
0
投票

不需要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
© www.soinside.com 2019 - 2024. All rights reserved.