为特定服务配置tomcat https

时间:2014-05-11 08:54:10

标签: java tomcat tomcat7 tomcat6

我有一个Web应用程序,其中一个特定服务需要通过安全https,其他所有服务应该是http,我做了:

<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
           maxThreads="150" scheme="https" secure="true"
           keystoreFile="${user.home}/keystore/keystore.jks" keystorePass="test"
           truststoreFile="${user.home}/keystore/keystore.jks" truststorePass="test"      
           truststoreType="JKS" disableUploadTimeout="true"   
           enableLookups="true" maxHttpHeaderSize="8192" 
           maxSpareThreads="75" minSpareThreads="25"
           clientAuth="true" sslProtocol="TLS" />

但是它希望每个服务都是https,这是我可以配置tomcat以满足我的要求吗?

1 个答案:

答案 0 :(得分:1)

您可以在同一台服务器上同时运行HTTP和HTTPS,只需为http添加另一个连接器。

<Connector port="80" protocol="HTTP/1.1"
           maxThreads="150" 
           disableUploadTimeout="true"   
           enableLookups="true" maxHttpHeaderSize="8192" 
           maxSpareThreads="75" minSpareThreads="25" />

<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
           maxThreads="150" scheme="https" secure="true"
           keystoreFile="${user.home}/keystore/keystore.jks" keystorePass="test"
           truststoreFile="${user.home}/keystore/keystore.jks" truststorePass="test"      
           truststoreType="JKS" disableUploadTimeout="true"   
           enableLookups="true" maxHttpHeaderSize="8192" 
           maxSpareThreads="75" minSpareThreads="25"
           clientAuth="true" sslProtocol="TLS" />