Chrome升级至新版本后,本地项目都无法访问

文章目录[隐藏]

Chrome 升级至新版本后,本地项目都无法访问

症状

本地开发改 hosts, chrome 不支持 xxx.app 改成 xxx.local 就正常了

chrome地址栏输入:xxx.app,回车后页面显示结果:

This site can't be reached
xxx.app refused to connect.

原因

chrome最新版强制http转向https

观察地址栏:会发现原来的

xxx.app被强制加上https://变成https://xxx.app

解决

chrome浏览器地址栏输入:

chrome://net-internals/#hsts

在该页面中搜索:

Query HSTS/PKP domain

在其下方的 Domain 后面的输入框中输入自己无法访问的域名,比如:domain.app,点击Query进行查询,如果有类似下面的结果,说明该域名后缀无法使用http前缀。

Found:
static_sts_domain: <span data-mce-type='bookmark' style='display: inline-block; width: 0px; overflow: hidden; line-height: 0; class='mce_SELRES_start'></span>app
static_upgrade_mode: FORCE_HTTPS
static_sts_include_subdomains: true
static_sts_observed: 1508821200
static_pkp_domain:
static_pkp_include_subdomains:
static_pkp_observed:
static_spki_hashes:
dynamic_sts_domain:
dynamic_upgrade_mode: UNKNOWN
dynamic_sts_include_subdomains:
dynamic_sts_observed:
dynamic_sts_expiry:
dynamic_pkp_domain:
dynamic_pkp_include_subdomains:
dynamic_pkp_observed:
dynamic_pkp_expiry:
dynamic_spki_hashes:

如果没有任何返回结果,代表该域名后缀可以直接使用http协议,比如:domain.test 亲测可用。

注:目前chrome中,dev和app都不可用。

另外,首次访问自己新修改的域名domain.test时,必须加上http://否则无法正确访问。

最后,如果你是使用的valet,并且不介意被强制转向https,可以在终端中输入:

valet secure yourdomain
声明:本文为原创,作者为 Svlik,转载时请保留本声明及附带文章链接:http://www.svlik.com/750.html