tomcat 配置https

server.xml:

   <Connector port="1443" protocol="HTTP/1.1" SSLEnabled="true" URIEncoding="UTF-8"
      maxThreads="1000" maxPostSize="0" scheme="https" secure="true"
      compression="on" compressionMinSize="2048" compressableMimeType="text/html,text/xml,text/javascript,text/css,text/plain,application/json" useSendfile="false"
      clientAuth="false" sslProtocol="TLS" keystoreFile="conf/127.0.0.1.jks" keystorePass="123456" truststoreFile="conf/127.0.0.1.jks"/>
    

web.xml:绑定https的请求

 <security-constraint>
  <web-resource-collection>
   <web-resource-name>SSL</web-resource-name>
   <url-pattern>/ssl/*</url-pattern>
  </web-resource-collection>

  <user-data-constraint>
   <transport-guarantee>CONFIDENTIAL</transport-guarantee>
  </user-data-constraint>
 </security-constraint>

相关推荐