agalwood / Motrix

A full-featured download manager.
https://motrix.app
MIT License
45.72k stars 4.57k forks source link

[BUG]: 无法通过本地环回域名localhost连接RPC #1492

Closed Dave-12138 closed 1 year ago

Dave-12138 commented 1 year ago

Bug 描述

可以通过//127.0.0.1:16800/jsonrpc连接RPC,但无法通过//localhost:16800/jsonrpc连接

Motrix 版本

1.8.19 / win11 / Windows Universal

环境

  System:
    OS: Windows 10 10.0.22621
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 14.93 GB / 23.86 GB
  Binaries:
    Node: 16.19.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 8.19.3 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22621.1702.0), Chromium (113.0.1774.42)
    Internet Explorer: 11.0.22621.1

复现步骤

启动更新后的Motrix 使用Aria2 Explorer默认配置(localhost:16800/jsonrpc)连接ARIA2 RPC,提示连接失败 修改Aria2 Explorer配置(127.0.0.1:16800/jsonrpc)连接ARIA2 RPC,连接成功

额外信息

No response

验证

agalwood commented 1 year ago
image

我在 macOS 和 Windows 11 实测是可以的,Windows 里的 C:\Windows\System32\drivers\etc\hosts 文件里的解释是

localhost name resolution is handled within DNS itself.

如果不行的话就在 hosts 文件末尾里加上一行 127.0.0.1 localhost

Dave-12138 commented 1 year ago

image 我在 macOS 和 Windows 11 实测是可以的,Windows 里的 C:\Windows\System32\drivers\etc\hosts 文件里的解释是

localhost name resolution is handled within DNS itself.

如果不行的话就在 hosts 文件末尾里加上一行 127.0.0.1 localhost

笑死,是浏览器HSTS自动跳转的锅,localhost的http会自动跳到https

在edge://net-internals/#hsts2里删一下localhost就好了