为什么在浏览器中 facebook.com 即使在删除 cache/history 后仍自动调用 https://www.facebook.com

In browser why facebook.com automatically call https://www.facebook.com even after deleting cache/history

在我的 /etc/hosts 中,我添加了一个条目指向 www.facebook.com 我的本地 IP 地址。 现在即使删除了完整的 cache/browser 历史记录,为什么键入 www.facebook.com 调用 https://www.facebook.com

这是由于 HSTS

正如 Troy Hunt 解释的那样:

This is Chrome saying “I’m not even going to issue that request, instead I’m going to change it to HTTPS then try again” which is what gives us the second request. This is key: Chrome has refused to issue the first request over the insecure HTTP protocol.

请注意与您描述的相似之处 - 它自动将 http 更改为 https

HSTS 可防止中间人攻击。您将 facebook.com 指向本地主机,基本上是 中间人攻击。

https://www.google.com/search?q=disable+hsts shows how to disable it if necessary. Or https://null-byte.wonderhowto.com/how-to/bypass-facebooks-hsts-0169414/ 可能会绕过它。