Tomcat使用端口443处理http,不要https!

对Tomcat有什么误解?

我有我的应用程序在Tomcat上部署为ROOT.war。 有一个URL只能通过SSL访问。

Tomcat处理这个URL很好:

HTTP://本地主机:443 / securedUrl

不要处理这个URL:

https:// localhost / securedUrl

为什么?

一块$ CATALINA_HOME / conf / server.xml:

<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="443" /> <Connector port="443" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="true" disableUploadTimeout="true" acceptCount="100" debug="0" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" keystoreFile="/webapps/ROOT/myapp.keystore.bin" keystorePass="lalala" /> 

$ CATALINA_HOME / webapps / ROOT / WEB-INF / web.xml:

  <security-constraint> <web-resource-collection> <web-resource-name>secured_postbacks</web-resource-name> <url-pattern>/securedUrl</url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee>CONFIDENTIAL</transport-guarantee> </user-data-constraint> </security-constraint> </web-app> 

HTTP可以愉快地在端口443上运行。HTTPS不是HTTP–它是通过​​TLS或SSL的HTTP–它可以愉快地在端口80上运行。

他们是不一样的: http:// localhost:443 / securedUrl和https:// localhost / securedUrl不指向相同的资源。