【问题标题】:how to redirect a url like https://example.com to https://www.example.com in haproxy如何在 haproxy 中将 https://example.com 之类的 url 重定向到 https://www.example.com
【发布时间】:2015-12-29 03:18:55
【问题描述】:

我知道如何重定向:

http example.com 到 https www.example.com 和 http www.example.com 到 https www.example.com

但不知道如何重定向:

在 Haproxy 中 https example.com 到 https www.example.com

在两个前端都重定向前缀https://www.example.com code 301 if { hdr(host) -i example.com }

【问题讨论】:

    标签: redirect haproxy


    【解决方案1】:
    frontend weblb
    bind *:80
    acl is_www hdr_beg(host) ilanni.com
    redirect prefix https://www.ilanni.com code 301 if is_www
    
    acl is_host hdr_beg(host) wwww.ilanni.com
    redirect scheme https if !{ ssl_fc }
    bind *:443 ssl crt /etc/haproxy/ilanni.com.pem
    
    use_backend sellerserver if is_host
    
    backend sellerserver
    balance source
    server web1 127.0.0.1:8111 maxconn 1024 weight 3 check inter 2000 rise 2 fall 3 
    

    【讨论】:

      猜你喜欢
      • 2020-09-24
      • 2015-09-25
      • 1970-01-01
      • 2011-07-06
      • 2011-08-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多