当我调试Visual Studio项目使用Chrome浏览器尝试重定向到https相当于我的web地址。我没有在web项目中启用SSL,并且开始URL是http URL。当我使用FireFox或IE进行调试时,我没有这个问题。

我重新安装了Chrome浏览器,解决了这个问题一天。没有下载任何插件的问题再次发生了第二天。

什么是使Chrome重定向localhost到https?

网络巡检显示: 请求URL:数据:text / html, chromewebdata 请求头 显示临时标题 User-Agent:Mozilla/5.0 (Windows NT 6.3;WOW64) AppleWebKit/537.36 (KHTML,像Gecko) Chrome/36.0.1985.143 Safari/537.36

这些选项卡中没有预览和响应数据。


当前回答

如果你碰巧在Wordpress网站上工作,在尝试了这个页面上的所有内容后,http://127.0.0.1/wp-admin仍然被重定向到https://127.0.0.1/wp-admin。试试这个:

进入wp-config.php并替换

定义(' WP_HOME ', ' https://example.com ');

define('WP_SITEURL','https://example.com');

to

定义(' WP_HOME ', ' http://127.0.0.1 ');

define('WP_SITEURL','http://127.0.0.1');

在Chrome和Firefox上测试。

其他回答

The issue could be replicated in VS 2019 also. This is caused due to "Enable Javascript debugging from Visual Studio IDE". The VS attaches to Chrome and it is a possibility that due to security or reasons known to Google and Microsoft, it sometimes fails to attach and you have this issue. I am able to run http and https with localhost from ASP net core 3.1 app. So while debugging in VS, go to the run with arrow -> IIS express, just below "Web Browser(Chrome)" select "Script Debugging (Disabled)".

参见文章:https://devblogs.microsoft.com/aspnet/client-side-debugging-of-asp-net-projects-in-google-chrome/

https://learn.microsoft.com/en-us/visualstudio/debugger/debugging-web-applications?view=vs-2019

总是退回到微软文档,以获得比谷歌更清楚的问题。

我如何用chrome 79解决这个问题:

只需粘贴这个url在你的搜索输入chrome://flags/#allow-insecure-localhost

它通过使用实验特性帮助了我。

在我的例子中,我把我的项目路径设置为/Users/me/dev/project_root/,并从那里运行nodeJS/express服务器。 将我的路径重命名为/Users/me/project_root(将dev从项目路径中移除)解决了这个问题。

这很可能与这项新规定有关:

Chrome 63(自2017年12月发布)将强制所有以。dev(和。foo)结尾的域通过预加载的HTTP严格传输安全(HSTS)头重定向到HTTPS。

你可以在这里找到更多信息。

使用:

谷歌Chrome版本70.0.3538.110(正式版本)(64位) nodeJS v9.2.0

以我为例,我在Mac电脑上使用浏览器同步,浏览器不断将http://localhost:3000重定向到https://localhost:3000。

我正在使用代客服务本地网站,我已经运行代客安全在本地*。因为我在浏览器同步中代理这个HTTPS域,所以浏览器正在用HTTPS加载localhost:3000。

为了解决这个问题,我不得不:

运行valet unsecure删除SSL证书 运行代客重启 重启browser-sync 在浏览器中打开localhost:3000(在我的情况下,Vivaldi是一个Chromium浏览器) 开放开发人员工具 勾选“网络”选项卡上的“禁用缓存” 刷新页面

我从来没有找到问题的根源,但我能够解决这个问题。 我删除了谷歌Chrome应用程序缓存文件夹,解决了这个问题。

C: \用户[用户]\ AppData \ Local的谷歌的Chrome