在http上提供静态文件,在https上提供其他文件

b91juud3  于 2021-10-10  发布在  Java
关注(0)|答案(0)|浏览(145)

我在外部tomcat上部署了一个spring引导应用程序。
我的网址是https://sampletest.com 在前端配置。
在index.html中,我有如下静态资源

<link rel="stylesheet" type="text/css" href="assets/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="assets/css/bootstrap.min.js">

我想在http上提供静态资源,在https上提供其他资源。
当我进入sampletest.com时,它在https上提供静态资源。
我进去的时候http://sampletest.com 找不到错误网页。
server.xml:

<Connector port="80" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="443" />

    <Connector  port="443" protocol="org.apache.coyote.http11.Http11NioProtocol"
        maxThreads="150"
        minSpareThreads="25" 
        maxSpareThreads="75"
        scheme="https" 
        secure="true"
        SSLEnabled="true" 
        clientAuth="false"
        sslProtocol="TLS"
        keystoreFile="keystore location"
        keystorePass="key"/>

web.xml:

<security-constraint>
    <web-resource-collection>
        <web-resource-name> unsecure url</web-resource-name>
        <url-pattern>/assets/*</url-pattern>
    </web-resource-collection>
    <user-data-constraint>
   <transport-guarantee>NONE</transport-guarantee> 
    </user-data-constraint>
</security-constraint>

谢谢

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题