如何为具有 http 和 https 的混合网站添加 hsts?

How can i add hsts for a mixed website with http and https?

网络服务器使用的是nginx 假设我有一个网站 http://www.test.com. and then there is https://test.com?market。 我正在将 test.com 的所有 https 重定向到 301 http 假设我想为 url 启用 https 严格传输安全 header .我可以很容易地在nginx中添加它。 但问题是测试也通过浏览器移动到 https(这是一个 307 重定向)并且从服务器再次重定向到导致测试无限循环,

HSTS无一例外地申请域的所有页面。所以这是不可能的。 (307只是浏览器内部代码,表示HSTS强制http->https重定向)

此外,即使对于静态页面,使用 https 也很重要。 (如果您需要更多详细信息,请询问!)