5
我有一个Tomcat 6服务器,我希望所有东西都在SSL后面,但是我希望通过非ssl访问一个servlet。这样可以配置Tomcat吗?它目前设置为将所有请求转发到安全端口。在Tomcat 6中同时使用SSL和非SSL
我有一个Tomcat 6服务器,我希望所有东西都在SSL后面,但是我希望通过非ssl访问一个servlet。这样可以配置Tomcat吗?它目前设置为将所有请求转发到安全端口。在Tomcat 6中同时使用SSL和非SSL
实现此目的的一种方法是编辑web应用程序的web.xml。
我假设你已经有Web应用程序设置为强制与<transport-guarantee> CONFIDENTIAL
所有请求到https像下面
<security-constraint>
<display-name>Example Security Constraint</display-name>
<web-resource-collection>
<web-resource-name>Protected Area</web-resource-name>
<!-- Define the context-relative URL(s) to be protected -->
<url-pattern>/*</url-pattern>
<!-- If you list http methods, only those methods are protected -->
<http-method>DELETE</http-method>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>PUT</http-method>
</web-resource-collection>
<auth-constraint>
<!-- Anyone with one of the listed roles may access this area -->
<role-name>tomcat</role-name>
<role-name>role1</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
现在低于此添加其他块要绕过HTTPS为servlet。
<security-constraint>
<web-resource-collection>
<web-resource-name>Unsecured resources</web-resource-name>
<url-pattern>/jsp/openforall.jsp</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
这个URL现在可以通过http访问openforall.jsp。
注意:如果有人以这种方式访问,此URL也将在https上可用。