0

我想强制将站点重定向到 SSL 认证站点。我已经在我的server.xmltomcat 配置中添加了这些配置。

<Connector port="8080" protocol="HTTP/1.1" 
           connectionTimeout="20000" 
           enableLookups="false"
           redirectPort="8443" />

<Connector port="8443" protocol="HTTP/1.1"
    SSLEnabled="true" maxHttpHeaderSize="8192"
    maxThreads="150" minSpareThreads="25"
    maxSpareThreads="75" enableLookups="false"
    disableUploadTimeout="true" acceptCount="100"
    scheme="https" secure="true"
    sslProtocol="TLS" keystoreFile="conf/{keystoreName}.jks"
    keystorePass="{KeyStorePass}" />

但我最终在非 SSL 和 SSL 认证站点中查看了我的站点。如何限制和重定向非 SSL 认证到 SSL 之一?

编辑:

这是我的 web.xml 的一部分:

<security-constraint>
    <web-resource-collection>
        <web-resource-name>HTTPSOnly</web-resource-name>
        <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <user-data-constraint>
        <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
</security-constraint>
<security-constraint>
    <web-resource-collection>
        <web-resource-name>HTTPSOrHTTP</web-resource-name>
        <url-pattern>*.ico</url-pattern>
        <url-pattern>/img/*</url-pattern>
        <url-pattern>/css/*</url-pattern>
    </web-resource-collection>
    <user-data-constraint>
        <transport-guarantee>NONE</transport-guarantee>
    </user-data-constraint>
</security-constraint>
4

0 回答 0