【发布时间】:2017-07-30 16:27:42
【问题描述】:
我有一个 haproxy 集群,它有两个用于 http 和 https 的前端以及许多使用 domain2backend 映射选择的后端。
某些后端只能通过 HTTPS 访问。
我尝试在这些后端使用redirect scheme https code 301 if !{ ssl_fc },但 haproxy 似乎忽略了它。我什至尝试简单地重定向(没有任何条件),但 haproxy 忽略了后端部分的重定向。
配置摘录:
global
maxconn 1024
debug
log localhost local0 debug
tune.ssl.default-dh-param 2048
defaults
balance roundrobin
maxconn 32
log global
monitor-uri /haproxy_test
timeout connect 5000ms
timeout client 50000ms
timeout server 50000ms
frontend http-in
bind *:8080
mode http
option httplog
option forwardfor
use_backend %[req.hdr(host),lower,map_dom(./etc/domain2backend.map)]
frontend https-in
bind *:4443 ssl crt ./etc/ssl
mode http
option httplog
option forwardfor
http-request add-header X-Proto https if { ssl_fc }
use_backend %[req.hdr(host),lower,map_dom(./etc/domain2backend.map)]
backend app1_www
redirect scheme https if !{ ssl_fc }
server localhost:3000 127.0.0.1:3000 check
backend app2_www
redirect scheme https
server localhost:3000 127.0.0.1:3000 check
app1_www 和 app2_www 重定向都不起作用。
我正在使用 HA-Proxy 版本 1.7.3 2017/02/28
【问题讨论】: