tomcat - urlrewrite 中的重定向循环(Tomcat)

标签 tomcat redirect https tuckey-urlrewrite-filter

我正在使用 urlrewite 过滤器在 Tomcat 中实现重定向以在页面中强制使用 https,但我创建的规则导致了重定向循环。

这是规则:

<rule match-type="wildcard">
    <condition type="scheme" operator="notequal">https</condition>
    <condition name="host" operator="equal">www.example.net</condition>
    <from>/en/page-name/</from>
    <to type="permanent-redirect" last="true">https://www.example.net/context/en/page-name/</to>
</rule>

有人可以帮助我吗?非常感谢。

最佳答案

您的条件:

<condition type="scheme" operator="notequal">https</condition>
<condition name="host" operator="equal">www.example.net</condition>
<from>/en/page-name/</from>

表示它不应以 https 开头,但主机应等于 www.example.net。

你的重定向:

https://www.example.net/context/en/page-name/

以 https 开头。你被重定向到这个页面,你不符合条件,被重定向到这个页面等等。

关于tomcat - urlrewrite 中的重定向循环(Tomcat),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35085741/

相关文章:

java - 如何使用 Spring security 2 和 Apache Tomcat 7 设置将 JSESSIONID cookie 设置为安全

rest - 配置tomcat怎么会产生503错误?

https - URLSession 或 Alamofire.Request 不适用于 URL 中的破折号?

java - 接收 JSON 响应

java - 将 XML 从 JSF textarea 传递到 Bean

.htaccess - 如果文件不存在则重定向到 root

php - 检查数据库的权限,如果找不到则重定向

tomcat - 为什么 Tomcat 管理器重定向到本地主机 :8080/company/www. company.org/index.html

PHP:无法打开流:参数无效

rest - 通过 HTTPs 使用 REST 服务时出错