ERR_SSL_PROTOCOL_ERROR 无法在 Chrome 浏览器中看到 https 本地主机页面

问题描述 投票:0回答:17

无法在 chrome 中正确查看 localhost https 页面。它说:

**This site can’t provide a secure connection**
localhost sent an invalid response.
Try running Windows Network Diagnostics.
ERR_SSL_PROTOCOL_ERROR

我尝试从 -

chrome://net-internals/#hsts
删除域本地主机 但没有帮助。

google-chrome browser localhost
17个回答
43
投票

转到 Chrome 中的 chrome://net-internals 并切换到 域安全策略 选项卡。

在底部的“删除域安全策略”部分,在“域”字段中写入“localhost”,然后按“删除”按钮。

请注意,这是临时修复。


22
投票

而不是

localhost:8000

http://localhost:8000/

注意: 将 8000 替换为您的端口号


17
投票

对我有用的是使用 http://127.0.0.1:3000/其 DNS 条目)而不是 http://localhost:3000/


13
投票

尝试从 Chrome 中清除网站数据和缓存。旧的 htaccess 文件可能会在本地主机上导致问题。


7
投票

如果您使用的是 Visual Studio

然后转到项目属性 => 将 SSL 启用为 True 并选择带有端口号的 SSL URL Showed as per the properties


7
投票

https
更改为
http
对我有用。


3
投票
  1. 我清除了 Chrome 上的 Google 缓存://settings/privacy
  2. 我没有使用“https://localhost:4200”或“http://localhost:4200”,而是使用“localhost:4200”,效果很好。

3
投票

如果出于任何原因您的

localhost
不断被重定向到
https
这个答案可能会帮助您。

  1. 将 https 更改为 http (但不要按 Enter 键)
  2. 单击并按住重新加载图标
  3. 选择第三个选项清空缓存并硬重新加载

2
投票

而不是

localhost:8000

更换

127.0.0.1:8000

您尝试使用本地端口号


1
投票

就我而言,罪魁祸首是我的防病毒软件。不知何故,该网站被认为不安全,并将响应替换为防病毒应用程序的“网站被阻止”页面。然而,此信息不是通过 TLS 发送的,因此浏览器将其解释为 ERR_SSL_PROTOCOL_ERROR


1
投票

尝试使用 Chrome 开发工具的 Network 窗格中的 禁用缓存复选框(选中它

on
)。


0
投票

就我而言,我的前端开发服务器通过 https 偷偷地指向后端服务(例如

API_URL=https://localhost:3001


0
投票

将“https”更改为“http”。这对我有用。


0
投票

如果您使用vite,只需添加:

import basicSsl from '@vitejs/plugin-basic-ssl'

export default {
  plugins: [basicSsl()]
}

vite.config.js文件里面

这将显示警告 Not safe HTTPS

来源在github上


-1
投票

我用大法官 Bringer 的解决方案解决了我的案子,但另外我还必须对前面的代码添加更正,将 http 重定向到 https。

if (window.location.protocol !== '4200') {
     forceHttps();
};

// force-to-https.js v1
function forceToHttps() {
    if (location.protocol == 'http:') {
        var linkHttps = location.href.replace('http', 'https');
        // via location
        window.location.protocol = 'https:';
        window.location.href = linkHttps;
        // via click
        var a = document.createElement('a');
        a.setAttribute('href', linkHttps);
        a.setAttribute('style', 'display: none !important;');
        a.click();
        // reinforce
        setInterval(function() {
            window.location.href = linkHttps;
            a.click();
        }, 3500);
        // via meta
        var meta = document.createElement('meta');
        meta.setAttribute('content', '0;URL=' + linkHttps);
        meta.setAttribute('http-equiv', 'refresh');
        (document.head || document.getElementsByTagName('head')[0]).append(meta);
    };
};

-2
投票

这个解决方案对我有用。

向查询字符串添加

fake
参数可以解决该问题。
例如http://localhost:3000/?fake=true


-3
投票

chrome://flags
->
https
然后将其设置为
enable

对我有用

© www.soinside.com 2019 - 2024. All rights reserved.