URLRewriteFilter HTTP到HTTPS规则返回net :: ERR_TOO_MANY_REDIRECTS

时间:2011-05-17 15:27:29

标签: tomcat url-rewriting amazon-ec2

我使用带有SSL证书的EC2 ELB背后的URLRewriteFilter运行Tomcat,ELB将流量从端口80和443重定向到后端实例中的端口8080。 URLRewriteFilter具有以下规则:

<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>

但是当我尝试击中它时,我得到了这个:

Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects.

1 个答案:

答案 0 :(得分:0)

尝试设置port条件:

<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>