首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

tomcat服务器一部分网页指定访问采用https协议

2012-10-24 
tomcat服务器部分网页指定访问采用https协议a、在tomcat安装目录下执行如下命令行:keytool -genkey -alias

tomcat服务器部分网页指定访问采用https协议

a、在tomcat安装目录下执行如下命令行:
keytool -genkey -alias tomcat -keyalg RSA -keypa
ss changeit -storepass changeit -keystore server.keystore -validity 3600
b、修改server.xml配置文件
??? <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
?????????????? maxThreads="150" scheme="https" secure="true"
?????????????? clientAuth="false" sslProtocol="TLS"
?????????????? keystoreFile="server.keystore"?
?????????????? keystorePass="changeit"/>
c、重启tomcat,应用的url通过http和https协议均可以访问
d、如果仅需要限定部分url的访问必须通过https协议,需要在web.xml增加如下配置项。
<security-constraint>
<web-resource-collection>
<web-resource-name>must https</web-resource-name>
<url-pattern>/test1/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
这种配置情况下,web.xml所在应用的访问url一旦是以test1开头的,均会被强迫转向https访问

热点排行