HTTP到HTTPS规则返回净

HTTP到HTTPS规则返回净

本文介绍了URLRewriteFilter HTTP到HTTPS规则返回净:: ERR_TOO_MANY_REDIRECTS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有Tomcat的运行与URLRewriteFilter背后EC2 ELB与SSL证书时,ELB被重定向从端口80和443端口8080的后端实例的流量。 URLRewriteFilter有这样的规则:

 <规则>
    <条件类型=方案操作符=notequal> HTTPS< /条件>
    <条件NAME =主机操作符=平等> ELB-DNS&LT​​; /条件>
    &其中;从>(。*)^ /&所述; /从>
    <为type =永久重定向> https://开头ELB-DNS / $ 1 LT; /到>
< /规则>
 

但是当我试图打它,我得到这样的:

 错误310(净值:: ERR_TOO_MANY_REDIRECTS):有太多重定向。
 

解决方案

尝试将端口条件:

 <规则>
    <条件类型=方案操作符=notequal> HTTPS< /条件>
    <条件NAME =主机操作符=平等> ELB-DNS&LT​​; /条件>
    <条件NAME =端口操作符=平等>(80 | 443)LT; /条件>
    &其中;从>(。*)^ /&所述; /从>
    <为type =永久重定向> https://开头ELB-DNS:8080 / $ 1 LT; /到>
< /规则>
 

I have Tomcat running with URLRewriteFilter behind an EC2 ELB with SSL certs,the ELB is redirecting traffic from ports 80 and 443 to port 8080 in the backend instances. URLRewriteFilter has this rule:

<rule>
    <condition type="scheme" operator="notequal">https</condition>
    <condition name="host" operator="equal">ELB-DNS</condition>
    <from>^/(.*)</from>
    <to type="permanent-redirect">https://ELB-DNS/$1</to>
</rule>

but when I try hitting it, I got this:

Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects.
解决方案

Try setting the port condition:

<rule>
    <condition type="scheme" operator="notequal">https</condition>
    <condition name="host" operator="equal">ELB-DNS</condition>
    <condition name="port" operator="equal">(80|443)</condition>
    <from>^/(.*)</from>
    <to type="permanent-redirect">https://ELB-DNS:8080/$1</to>
</rule>

这篇关于URLRewriteFilter HTTP到HTTPS规则返回净:: ERR_TOO_MANY_REDIRECTS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 00:24