禁止chrome自动重定向到https 浏览器输入http形式网址后自动跳转https解决方法
如果你的站点同时支持http及https协议,使用chrome访问时可能会遇到使用http协议访问时自动重定向到https的问题。
1、禁用“一律使用安全连接”选项
chrome://settings/security
中 禁用“一律使用安全连接”选项
开启了这个配置,会导致浏览器始终重定向到https

2、添加请求响应头Strict-Transport-Security: max-age=0
web服务响应头中添加Strict-Transport-Security: max-age=0
。

如果未设置该响应头,一旦你成功访问过对应的https(https://example.com)站点,后面再访问该http(http://example.com)站点将始终会重定向到https服务。
当然你可以通过 chrome://net-internals/#hsts
临时删除该域名的重定向配置,但是这种方式,后面只要成功访问过对应的https又会添加。
也可以修改web服务对 Upgrade-Insecure-Requests:1
请求头的处理逻辑,不进行重定向。
比如nginx中禁用 upgrade-insecure-requests
指令:
http {
add_header Content-Security-Policy “default-src ‘self’; upgrade-insecure-requests off”;
# …
}
3、使用带协议的链接(http://)
如果不带协议(如//example.com, http://example.com),将优先使用https访问
4、改安全策略
1、打开chrome浏览器,输入 chrome://net-internals/#hsts
2、在底部找到:Delete domain security policies,输入您的url (https),点击Delete
3、重启浏览器后,即可正常打开访问 “http+域名” 形式的网址了。