web.xml增加配置
<security-constraint> <web-resource-collection > <web-resource-name >SSL</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee>CONFIDENTIAL</transport-guarantee> </user-data-constraint> </security-constraint>
server.xml配置https8443端口
<Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol" maxThreads="150" SSLEnabled="true" scheme="https" secure="true" keystoreFile="conf/keystore.jks" keystorePass="123456" clientAuth="false" sslProtocol="TLS" URIEncoding="UTF-8" />
然后redirectPort都指向8443
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" />
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
在使用IE11,tomcat6.0.20時,ie訪問https端口會出現頁面無法訪問問題。可能是版本問題,換成tomcat7.0.94了就可以了。如有同類問題請參考。