Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: ForwardWebSocket / HTTP 在非 Windows 平台的 Host 配置需要和请求头的 Host 一致 #264

Open
4 tasks done
Xiangze-Li opened this issue Apr 1, 2024 · 3 comments
Assignees
Labels
bug Something isn't working wontfix This will not be worked on

Comments

@Xiangze-Li
Copy link

请确保您已阅读以上注意事项,并勾选下方的确认框。

  • 我已经仔细阅读上述内容
  • 我已经使用 最新构建 测试过,问题依旧存在。
  • 我已经在 Issue Tracker 中找过我要提出的问题,没有找到相同问题的ISSUE。
  • 我已知晓并同意,此处仅用于汇报程序中存在的问题。若这个 Issue 是关于其他非程序本身问题,则我的 Issue 可能会被无条件自动关闭或/并锁定。(其它疑问请考虑加入TG群询问或在discussions中提问)

Lagrange项目

OneBot

所使用/依赖的Lagrange项目对应的commit

db45b79

运行环境

Linux

运行架构

x64

连接方式

正向 WebSocket

重现步骤

在 appsettings.json 中配置正向 WS 的 Host 为 127.0.0.1,启动服务。

期望的结果是什么?

拉格兰监听 127.0.0.1 的指定端口,服务正常。

实际的结果是什么?

netstat 显示拉格兰确实在监听 127.0.0.1 的指定端口,但下游服务无法连接。

显示错误信息为 websocket: bad handshake

简单的复现代码/链接(可选)

No response

日志记录(可选)

No response

补充说明(可选)

注意到,如果将 Host 填写为 localhost,可以达成与之前填写 127.0.0.1 相同的效果。

对于网络服务来说,127.0.0.1localhost 应该是完全等价的。甚至前者应该是比后者更严谨的。这里的 Breaking Change 不利于用户升级版本。建议做出更改以适配两种写法。

@Xiangze-Li Xiangze-Li added the bug? Maybe it's a bug label Apr 1, 2024
@DarkCWK
Copy link
Collaborator

DarkCWK commented Apr 1, 2024

我测试用的就是 127.0.0.1 , 不太可能不支持
可能是其他原因, 可以提供其他的情报么

例如
拉格兰的配置是什么,连接失败时拉格兰的日志
对端的 bot 是什么,它的配置和复现的代码,连接失败时的日志

@ishkong ishkong changed the title [Bug?]: ForwardWebSocket 重构后不兼容 Host 127.0.0.1 [Bug]: ForwardWebSocket 重构后在非Windows平台localhost127.0.0.1不等价 Apr 1, 2024
@ishkong ishkong added bug Something isn't working wontfix This will not be worked on and removed bug? Maybe it's a bug labels Apr 1, 2024
@ishkong ishkong pinned this issue Apr 1, 2024
@ishkong ishkong changed the title [Bug]: ForwardWebSocket 重构后在非Windows平台localhost127.0.0.1不等价 [Bug]: ForwardWebSocket / HttpPost 重构后在非Windows平台localhost127.0.0.1不等价 Apr 1, 2024
@ishkong ishkong changed the title [Bug]: ForwardWebSocket / HttpPost 重构后在非Windows平台localhost127.0.0.1不等价 [Bug]: ForwardWebSocket / HttpPost 在非Windows平台localhost127.0.0.1不等价 Apr 1, 2024
@Xiangze-Li
Copy link
Author

wontfix 呜呜呜

@ishkong ishkong changed the title [Bug]: ForwardWebSocket / HttpPost 在非Windows平台localhost127.0.0.1不等价 [Bug]: ForwardWebSocket / HTTP 在非Windows平台 localhost127.0.0.1不等价 Apr 1, 2024
@DarkCWK
Copy link
Collaborator

DarkCWK commented Apr 1, 2024

在 Linux 上,用于 ForwardWebSocketHttpHost 必须使用与请求头中的 Host 相同的值,但 *+ 除外!这是一个上游错误。

@DarkCWK DarkCWK changed the title [Bug]: ForwardWebSocket / HTTP 在非Windows平台 localhost127.0.0.1不等价 [Bug]: ForwardWebSocket / HTTP 在非 Windows 平台的 Host 需要和请求头的 Host 一致 Apr 2, 2024
@DarkCWK DarkCWK changed the title [Bug]: ForwardWebSocket / HTTP 在非 Windows 平台的 Host 需要和请求头的 Host 一致 [Bug]: ForwardWebSocket / HTTP 在非 Windows 平台的 Host 配置需要和请求头的 Host 一致 Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants