Redirect SSL使用HAproxy卸载/重定向特定URL?

Redirect SSL使用HAproxy卸载/重定向特定URL?,redirect,ssl,load-balancing,haproxy,Redirect,Ssl,Load Balancing,Haproxy,我有一个使用硬件负载均衡器的工作设置,该均衡器控制重定向,所有到*的请求都被重定向(使用HTTP 302)到*并且所有不用于/登录的请求都从HTTPS反向重定向到HTTP 这使我能够将登录函数和用户/密码交换封装在SSL中,但在其他方面可以避免使用加密减慢连接速度,还可以解决某些浏览器中嵌入内容混合内容警告的一些问题 然而,负载平衡是生命的终结,我正在寻找一个替代解决方案,最好是在软件中 我认为HAproxy将能够作为我的负载平衡解决方案,但我只能找到配置示例和文档,用于将所有内容从HTTP重定

我有一个使用硬件负载均衡器的工作设置,该均衡器控制重定向,所有到*的请求都被重定向(使用HTTP 302)到*并且所有不用于/登录的请求都从HTTPS反向重定向到HTTP

这使我能够将登录函数和用户/密码交换封装在SSL中,但在其他方面可以避免使用加密减慢连接速度,还可以解决某些浏览器中嵌入内容混合内容警告的一些问题

然而,负载平衡是生命的终结,我正在寻找一个替代解决方案,最好是在软件中

我认为HAproxy将能够作为我的负载平衡解决方案,但我只能找到配置示例和文档,用于将所有内容从HTTP重定向到HTTPS,或者从HTTP重定向到HTTPS

是否可以使用HAproxy实现我的建议,或者我应该寻找不同的解决方案


我意识到我需要使用HAproxy的开发版本来支持SSL。

我建议您不要在生产环境中使用开发版本

为了回答您的问题,我假设您将使用HAProxy 1.4版:

是否可以使用HAProxy实现我的建议,或者我是否应该寻找不同的解决方案?

对。这是可能的,但您必须使用另一个软件来处理
HTTPS
流量。在这方面被证明是好的。所以我想说,设置将是:

  • HAProxy 1.4

    # Redirect http://../login to https://../login
    frontend HTTPSRedirect
        bind 1.2.3.4:80
        default_backend AppServers
    
        redirect prefix https://www.domain.com/login if { path_beg -i /login }
    
    # Handler for requests coming from Stunnel4.
    frontend HTTPReceiver
        bind 5.6.7.8:80
        default_backend AppServers
    
    [https]
    accept=443
    connect=5.6.7.8:80 (HAProxy IP)
    
  • Stunnel4

    # Redirect http://../login to https://../login
    frontend HTTPSRedirect
        bind 1.2.3.4:80
        default_backend AppServers
    
        redirect prefix https://www.domain.com/login if { path_beg -i /login }
    
    # Handler for requests coming from Stunnel4.
    frontend HTTPReceiver
        bind 5.6.7.8:80
        default_backend AppServers
    
    [https]
    accept=443
    connect=5.6.7.8:80 (HAProxy IP)
    

我建议您不要在生产环境中使用开发版本

为了回答您的问题,我假设您将使用HAProxy 1.4版:

是否可以使用HAProxy实现我的建议,或者我是否应该寻找不同的解决方案?

对。这是可能的,但您必须使用另一个软件来处理
HTTPS
流量。在这方面被证明是好的。所以我想说,设置将是:

  • HAProxy 1.4

    # Redirect http://../login to https://../login
    frontend HTTPSRedirect
        bind 1.2.3.4:80
        default_backend AppServers
    
        redirect prefix https://www.domain.com/login if { path_beg -i /login }
    
    # Handler for requests coming from Stunnel4.
    frontend HTTPReceiver
        bind 5.6.7.8:80
        default_backend AppServers
    
    [https]
    accept=443
    connect=5.6.7.8:80 (HAProxy IP)
    
  • Stunnel4

    # Redirect http://../login to https://../login
    frontend HTTPSRedirect
        bind 1.2.3.4:80
        default_backend AppServers
    
        redirect prefix https://www.domain.com/login if { path_beg -i /login }
    
    # Handler for requests coming from Stunnel4.
    frontend HTTPReceiver
        bind 5.6.7.8:80
        default_backend AppServers
    
    [https]
    accept=443
    connect=5.6.7.8:80 (HAProxy IP)