Paw*_*wan 26 tomcat web.xml security-constraint
为了在Tomcat下进行SSL配置测试,这一切都是强制性的吗?
以下行来自网站:
为了对我们的测试执行此操作,请使用已在Tomcat中成功部署的任何应用程序,并首先通过http和https访问它以查看它是否正常工作.如果是,则打开该应用程序的web.xml,然后在web-app结束之前添加此XML片段,即
</web-app>:Run Code Online (Sandbox Code Playgroud)<security-constraint> <web-resource-collection> <web-resource-name>securedapp</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee>CONFIDENTIAL</transport-guarantee> </user-data-constraint> </security-constraint>
这个配置是否必须在web.xml文件中执行?
pal*_*int 41
不,这是没有必要的.这意味着您的Web应用程序仅通过HTTPS提供(并且不能通过HTTP获得).
如果省略<transport-guarantee>CONFIDENTIAL</transport-guarantee>标记(或整个标记<security-constraint>),您的应用程序将通过HTTP和HTTPS提供.如果您尝试使用HTTP,则web.xml包含<transport-guarantee>CONFIDENTIAL</transport-guarantee>Tomcat会自动将请求重定向到SSL端口.
请注意,默认的Tomcat配置不启用SSL连接器,您必须手动启用它.有关详细信息,请查看SSL配置HOW-TO.