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

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

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

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

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

  1. <Connector port="80" protocol="HTTP/1.1"
  2. connectionTimeout="20000"
  3. redirectPort="443" />
  4. <Connector port="443" protocol="org.apache.coyote.http11.Http11NioProtocol"
  5. maxThreads="150"
  6. minSpareThreads="25"
  7. maxSpareThreads="75"
  8. scheme="https"
  9. secure="true"
  10. SSLEnabled="true"
  11. clientAuth="false"
  12. sslProtocol="TLS"
  13. keystoreFile="keystore location"
  14. keystorePass="key"/>

web.xml:

  1. <security-constraint>
  2. <web-resource-collection>
  3. <web-resource-name> unsecure url</web-resource-name>
  4. <url-pattern>/assets/*</url-pattern>
  5. </web-resource-collection>
  6. <user-data-constraint>
  7. <transport-guarantee>NONE</transport-guarantee>
  8. </user-data-constraint>
  9. </security-constraint>

谢谢

暂无答案!

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

相关问题