LagrangeDev / Lagrange.Core

An Implementation of NTQQ Protocol, with Pure C#, Derived from Konata.Core
GNU General Public License v3.0
2.12k stars 263 forks source link

[Bug?]: 使用nonebot反向websocket连接时返回403 #516

Closed M-tongle closed 2 months ago

M-tongle commented 2 months ago

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

Lagrange项目

OneBot

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

1c1e8c6

运行环境

Linux

运行架构

arm64

连接方式

反向 WebSocket

重现步骤

使用nonebot初始bot(echo插件)

期望的结果是什么?

正常连接

实际的结果是什么?

返回403

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

No response

Trace 级别日志记录(可选)

warn: Lagrange.OneBot.Core.Network.Service.ReverseWSService[1001]
      [ReverseWSService] Disconnect(6347e6bc-f083-4260-9060-12c66e5e2a9e)
      System.Net.WebSockets.WebSocketException (0x80004005): The server returned status code '403' when status code '101' was expected.
         at System.Net.WebSockets.WebSocketHandle.ValidateResponse(HttpResponseMessage response, String secValue)
         at System.Net.WebSockets.WebSocketHandle.ConnectAsync(Uri uri, HttpMessageInvoker invoker, CancellationToken cancellationToken, ClientWebSocketOptions options)
         at System.Net.WebSockets.ClientWebSocket.ConnectAsyncCore(Uri uri, HttpMessageInvoker invoker, CancellationToken cancellationToken)
         at Lagrange.OneBot.Core.Network.Service.ReverseWSService.ExecuteAsync(CancellationToken stoppingToken)

补充说明(可选)

No response

M-tongle commented 2 months ago

nonebot返回: 08-18 08:22:11 [INFO] uvicorn | ('127.0.0.1', 42176) - "WebSocket /onebot/v11/ws" 403 08-18 08:22:11 [INFO] websockets | connection rejected (403 Forbidden) 08-18 08:22:11 [INFO] websockets | connection closed

Decrabbityyy commented 2 months ago

可能是未能正确配置nb端ACCESS_TOKEN,可贴上nb端与拉格兰端配置文件寻求更多帮助