2023年11月25日发(作者:)

完美解决浏览器输⼊http被⾃动跳转⾄https问题

在将服务尝试着从http协议往https协议迁移成功之后,⼜出于测试调试的⽬的将服务转回到http协议,却发现在浏览器输⼊http会被⾃动跳转到https

HTTP Strict Transport Security (HSTS) is an opt-in security enhancement that is specified by a web application through the use of a special

response header. Once a supported browser receives this header that browser will prevent any communications from being sent over HTTP

to the specified domain and will instead send all communications over HTTPS. It also prevents HTTPS click through prompts on browsers.

查阅相关资料,发现这是浏览器的HSTSHTTP Strict Transport Security)功能引起的。在安装配置SSL证书时,可以使⽤⼀种能使数据传输更加安全

Web安全协议,即在服务器端上开启HSTS ,它会告诉浏览器只能通过HTTPS访问,⽽绝对禁⽌HTTP⽅式。

因此,只要关闭浏览器的HSTS功能就可以解决这个问题,但是只能通过特定的⽅式,⽽不是清除浏览器缓存那么简单。

Chrome浏览器

1.地址栏中输⼊chrome://net-internals/#hsts

2.Delete domain中输⼊项⽬的域名,并Delete(删除)

3.可以在Query domain测试是否删除成功。

Opera浏览器

Chrome⽅法⼀样。

Safari浏览器

1.完全关闭Safari浏览器。

2.删除~/Library/Cookies/这个⽂件。

3.重新打开Safari即可(极少数情况下,可能需要重启系统)。

Firefox浏览器

1.关闭所有已打开的页⾯。

2.清空历史记录和缓存。

3.地址栏输⼊about:permissions

4.搜索项⽬域名,并点击Forget About This Site

ps:下⾯看下解决⾕歌浏览器http链接⾃动跳转到https的问题

有些⽹址http协议和https协议是两个服务,有时候需要访问http地址,但chrome会默认转成https请求地址,

这时候清理浏览器缓存之类的都是没有⽤的,需要进⾏如下操作,

chrome浏览器地址输⼊:

chrome://net-internals/#hsts

到此这篇关于浏览器输⼊http被⾃动跳转⾄https问题的⽂章就介绍到这了,更多相关http⾃动跳转⾄https内容请搜索以前的⽂章或继续浏览下⾯的相关⽂

章希望⼤家以后多多⽀持!