具有多个后端路径的Haproxy HTTP到HTTPs重定向

时间:2018-12-11 20:47:48

标签: haproxy

我的haproxy服务器是a.b.c.d,并且我的应用程序在somedomain:443和somedomain:8443上运行,需要重定向,如下所示。

Assembly.Load(File.ReadAllBytes(dllInBinPathString), FileReadAllBytes(pdbInBinPathString))

2 个答案:

答案 0 :(得分:0)

这是配置,正在使用。我希望这两种重定向都可以在单个前端和2个后端中完成,对吗?

listen WealthWeb  a.b.c.d:80
mode http
log global
balance roundrobin  # Load Balancing algorithm
option httpchk
option forwardfor
acl is_root path -i /

default_backend App1-443 App1-8443
#redirect code 301 location https://somedomain.com/some/path/here if is_root
#redirect code 301 location https://somedomain.com:8443/some/path/here if is_root

#server App1:443 App1-IP:443
#server App1:8443 App1-IP:8443

backend App1-443
acl is_root path -i /
redirect code 301 location https://somedomain.com/some/path/here if is_root
backend App1-8443
acl is_root path -i /
redirect code 301 location https://somedomain.com:8443/some/path/here if is_root

		
		
listen  JasperReport a.b.c.d:8080
mode http
balance roundrobin  # Load Balancing algorithm
option httpchk
option forwardfor
acl is_root path -i /

redirect code 301 location https://somedomain.com:8080/some/path/here if is_root

server App1:8080 App1-IP:8080 weight 1 maxconn 512 check

答案 1 :(得分:0)

最后修改如下配置。 需要后端RB0-web循环方式。

listen FrontEnd  IP:80
        mode http
        log global
        acl is_web path -i /
        acl is_web1 path -i /1
        acl is_web2 path -i /2
        acl is_report path -i /report

        use_backend B1-web if is_web1
        use_backend B2-web if is_web2
        use_backend RB0-web if is_web
        use_backend B-Report if is_report

backend B1-web
        mode http
        redirect code 301 location https://FQDN/web/ws/login/ulogin

backend B2-web
        mode http
        redirect code 301 location https://FQDN:8443/web/ws/login/ulogin

backend RB0-web
        mode http
        balance roundrobin
        option forwardfor
        redirect code 301 location https://FQDN:8443/web/ws/login/ulogin
        redirect code 301 location https://FQDN/web/ws/login/ulogin

backend B-Report
        mode http
        balance roundrobin
        option forwardfor
        redirect code 301 location https://FQDN:8080/jasperserver/login.html