URLRewriteFilter HTTP to HTTPS rule returning net::ERR_TOO_MANY_REDIRECTS

你说的曾经没有我的故事 提交于 2019-12-21 21:38:32

问题


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.

回答1:


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>


来源:https://stackoverflow.com/questions/6033226/urlrewritefilter-http-to-https-rule-returning-neterr-too-many-redirects

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!