我有多个具有独立配置的tomcat服务器,在同一台服务器上运行在不同的端口上。最近,将少数tomcat服务器从http转换为https。所以奇怪的问题是:
应用程序1:运行在https://x.y.z.w:10001 (https)应用程序2:运行在http://x.y.z.w:8888 (http)
如果我首先从浏览器(chrome/firefox)访问应用程序2,它可以正常工作。
如果我首先访问应用程序1,然后访问应用程序2,则应用程序2的URL将自动更改为https://x.y.z.w:8888。即使我重新启动浏览器,应用程序2URL也会被重定向到https。之后,删除浏览器缓存和访问应用程序2是解决这一问题的唯一途径。
如何防止应用程序2 URL被自动重定向到https?
发布于 2019-10-15 18:16:39
为应用程序1的tomcat web.xml文件添加了下面的代码。这对我没什么帮助。
<filter>
<filter-name>httpHeaderSecurity</filter-name>
<filter-class>org.apache.catalina.filters.HttpHeaderSecurityFilter</filter-class>
<async-supported>true</async-supported>
<init-param>
<param-name>hstsEnabled</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>hstsMaxAgeSeconds</param-name>
<param-value>0</param-value>
</init-param>
</filter>发布于 2019-10-16 06:47:35
这个问题现在已经解决了。在Spring引导应用程序的WebSecurityConfigurerAdapter中添加了代码。
http
.headers()
.httpStrictTransportSecurity()
.includeSubDomains(false)
.maxAgeInSeconds(0);Regds -raju
https://stackoverflow.com/questions/58398695
复制相似问题