Localhost not working in Chrome, 127.0.0.1 does work
# English
Here are the steps I took to make this work correctly:
- Edited my hosts file so
127.0.0.1 localhost.was present, and saved the file - Cleared my Chrome cache, specifically cookies and cached files
- Cleared host cache in
chrome://net-internals/#dns - Restarted chrome
Alternatively, this also works:
- Navigate to
chrome://net-internals/#hsts - Under "Delete domain", type
localhostand delete
Unbeknownst to me, my project had an HSTS middleware that set an HSTS cookie
# Chinese
Edge 版本:120.0.2210.133 (正式版本) (64 位)
Chrome 版本:120.0.6099.217 (正式版本) (64 位)
该版本下成功,仅供参考。
打开 Edge 浏览器 / Chrome 浏览器
地址栏输入你要访问的 http 网址,并访问(此时会自动转成 https,这一步不能跳过,接下来继续)
地址栏输入以下地址,并访问:
Edge 浏览器:edge://net-internals
edge://net-internals |
Chrome 浏览器:chrome://net-internals
chrome://net-internals |
左侧选择: Domain Security Policy
右侧的 Query HSTS/PKP domain 下的输入框中输入你要访问的网址(不带 \http:// 前缀),点击输入框后的 Query 按钮
如果列出一堆东西,那么继续;如果列出 Not found ,那么返回第 2 步重新执行
在右侧的 Delete domain security policies 下的输入框中输入你要访问的网址(不带 \http:// 前缀),点击输入框后的 Delete 按钮
再次进入第 5 步操作,如果列出 Not found ,那么问题解决,地址栏输入你要访问的 http 网址(带 \http:// 前缀)