在Tomcat6中同时使用SSL和非SSL
我有一个Tomcat6服务器,我希望所有东西都支持SSL,但是我希望有一个servlet可以通过非SSL访问。可以这样配置Tomcat吗?它当前设置为将所有请求转发到安全端口。实现此目的的一种方法是编辑web应用程序的web.xml 我假设您已经设置了web应用程序,可以使用在Tomcat6中同时使用SSL和非SSL,tomcat,tomcat6,Tomcat,Tomcat6,我有一个Tomcat6服务器,我希望所有东西都支持SSL,但是我希望有一个servlet可以通过非SSL访问。可以这样配置Tomcat吗?它当前设置为将所有请求转发到安全端口。实现此目的的一种方法是编辑web应用程序的web.xml 我假设您已经设置了web应用程序,可以使用机密文件将所有请求强制发送到https,如下所示 <security-constraint> <display-name>Example Security Constraint</d
机密文件将所有请求强制发送到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>
示例安全约束
保护区
/*
删除
得到
邮递
放
雄猫
角色1
保密的
现在在下面为您希望绕过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>
无担保资源
/jsp/openforall.jsp
没有一个
现在可以通过http访问这个URL openforall.jsp
注意:如果有人以这种方式访问此URL,则此URL在https上仍然可用