栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

Tomcat中特定页面/ URL模式的SSL

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Tomcat中特定页面/ URL模式的SSL

使https生效的唯一方法是

server.xml
<service>
标记下的文件上写入适当的连接器。设置连接器后,您可以使用http或https访问服务器中的所有应用程序。唯一的区别是使用了哪种连接器。通常,http和https的连接器如下所示:

<Connector port="80" protocol="HTTP/1.1"maxThreads="150" connectionTimeout="20000"redirectPort="443"URIEncoding="UTF-8" compression="on"/><Connector port="443" protocol="HTTP/1.1"maxThreads="150" connectionTimeout="20000"SSLEnabled="true" scheme="https" secure="true"keystoreFile="conf/.keystore"keystorePass="changeit"clientAuth="false" sslProtocol="TLS"URIEncoding="UTF-8" compression="on"/>

然后,您可以通过添加

transport-guarantee
标记来强制您的应用程序始终使用https,而该标记
web.xml
最终会是这样的:

<security-constraint>    <web-resource-collection>        <web-resource-name>Administrators</web-resource-name>        <url-pattern>/*</url-pattern>    </web-resource-collection>    <auth-constraint>        <role-name>Administrators</role-name>    </auth-constraint>    <user-data-constraint>        <transport-guarantee>CONFIDENTIAL</transport-guarantee>    </user-data-constraint></security-constraint>

您可以

transport-guarantee
为定义的不同Web资源更改。因此,您可以保护站点的某些部分,而不能保护其他部分。

最后,插入连接器

server.xml
并不会强制您在所有应用程序中使用https。它仅允许使用https连接器。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/412737.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号