[英]How do I redirect https:// requests to http:// in resin4.0
in fact, i got the method for redirect http to https ,as I add a filter in web.xml. 事实上,我得到了将http重定向到https的方法,因为我在web.xml中添加了一个过滤器。 such as,
如,
<security-constraint>
<web-resource-collection>
<web-resource-name>SSL</web-resource-name>
<url-pattern>/xxx/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
in this case, I can make the urls like /xxx/*
to be requested in https mode. 在这种情况下,我可以在https模式下输入像
/xxx/*
这样的URL。 There are some others urls like /yyy/*
which must be requested in http mode, so how can I do that ? 还有一些其他网址如
/yyy/*
必须在http模式下请求,所以我该怎么做?
In the resin-web.xml, you can use the Resin rewrite tags to redirect to a different URL and check for conditions like IfSecure. 在resin-web.xml中,您可以使用Resin重写标记重定向到不同的URL并检查IfSecure等条件。
For example, your WEB-INF/resin-web.xml might look like 例如,您的WEB-INF / resin-web.xml可能看起来像
<web-app xmlns="http://caucho.com/ns/resin"
xmlns:resin="urn:java:com.caucho.resin">
<resin:Redirect regexp="^/xxx/" target="https://myhost.com/xxx/">
<resin:IfSecure value="false"/>
</resin:Redirect>
<resin:Redirect regexp="^/yyy/" target="http://myhost.com/yyy/">
<resin:IfSecure value="true"/>
</resin:Redirect>
</web-app>
The first matches on your /xxx, and checks if it's an SSL connection. / xxx上的第一个匹配项,并检查它是否为SSL连接。 If isn't an SSL connection, it redirects to the https for the host.
如果不是SSL连接,则会重定向到主机的https。 Otherwise the rule is ignored.
否则,该规则将被忽略。
The second matches on your /yyy, and checks if it's an SSL connection. 你的/ yyy上的第二个匹配,并检查它是否是SSL连接。 If it is an SSL connection, it redirects to the http for your host.
如果是SSL连接,则会重定向到主机的http。 Otherwise the rule is ignored.
否则,该规则将被忽略。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.