我在作为负载均衡器的所有前端服务器前面都有HAProxy。它将所有传入的请求重定向到https:
frontend front_http
mode http
redirect scheme https if !{ ssl_fc }
maxconn 10000
bind 0.0.0.0:80
reqadd X-Forwarded-Proto:\ http
default_backend back_easycreadoc
frontend front_https
mode http
maxconn 10000
bind 0.0.0.0:443 ssl crt /etc/haproxy/ssl.crt
reqadd X-Forwarded-Proto:\ https
default_backend back_easycreadoc
我们将添加一些我们没有证书的域名(我们不拥有这些域名,我们的客户拥有它们)。如何在端口80上通过连接而不将其重定向到https,但仅针对这些域?
答案 0 :(得分:3)
frontend front_http
mode http
acl host_one hdr(host) -i www.one.com
acl host_two hdr(host) -i www.two.com
redirect scheme https if !host_one !host_two
maxconn 10000
bind 0.0.0.0:80
reqadd X-Forwarded-Proto:\ http
default_backend back_easycreadoc
http://cbonte.github.io/haproxy-dconv/configuration-1.5.html#redirect