服务器响应带有 HSTS header ,并且由于我使用反向代理,HSTS header 也通过代理响应发送。 由于存在不同的域(代理和服务器),HSTS 是否使浏览器自动更改架构 http://proxyhost.com至https://proxyhost.com ?或者预加载列表会自动调用https://serverhost.com当用户请求http://proxyhost.com时?
最佳答案
does HSTS make the browser automatically change the schema from
http
tohttps
确实!自从:
a reverse proxy HSTS header is also being sent through proxy response.
...反向代理的配置可能会不自觉地使您的域设置HSTS
header 。
花了一些时间才明白为什么我的 apache 服务器设置了 HSTS header - 因为我没有在 apache Web 服务器中配置它。这是由于 ReverseProxy
:当外部域设置 HSTS
header 时,该 header 会带有我的域名(反向代理!)。然后将其传播到存储它的客户端浏览器。因此,我的所有域站点(在这种情况下还有我的所有子域!)都被迫使用 https
(当然不是使用 curl
时,而是 firefox
、 Chrome
等)。
感谢您的问题 - 这已经是完美的方向!
就我而言,我只需使用RewriteRule
而不是反向代理
:)但这当然取决于您的场景。
您还在评论中给出了正确的答案:
in this case I should unset HSTS header in the reverse proxy
对!只需在 ProxyPassReverse
指令后直接添加 Header unset Strict-Transport-Security
即可使用反向代理,而无需继承 HSTS
header 。
关于apache - 严格传输安全对重定向到 https 的 http 反向代理的影响,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39101191/