我正遇到一个与 nginx + websocket 有关的怪异问题,因此想问问你们是否可以让我知道导致此错误的原因以及是否有解决方法。
>我在基于 nginx + php-fpm 的服务器上运行了一个聊天室网站( https ),并且该聊天室脚本使用了websocket( wss )和nginx反向代理进行连接,所以现在的问题是,它随机地向不同的用户发送502握手错误,并阻止他们加载聊天室。这是错误:
Class Class1
Public Shared Sub Main()
Dim c As New Class1
Console.WriteLine(c.MyProp(upper:=True))
End Sub
Public Sub New()
MyProp = "lower"
End Sub
Public ReadOnly Property MyProp As String
Public ReadOnly Property MyProp(upper As Boolean) As String
Get
If upper Then
Return MyProp.ToUpper()
Else
Return MyProp
End If
End Get
End Property
End Class
刷新页面几次或通过更改ip / internet后,他们可以进入聊天室,然后在几个小时或一天后的两天后的随机时间再次出现。
此反向代理的我的nginx配置:
WebSocket connection to 'wss://www.mydomain.com/chatserver/?xtoken:U3lzdGVt|3711|2|1|0|1569058371|8a41df869e3bef7e224f0873e3fed93df84ab90cbc5c4f01665e9a5886f64887' failed: Error during WebSocket handshake: Unexpected response code: 502
initws @ VM28:26
onload @ blabws.php:23
VM28:30 Event {isTrusted: true, type: "error", target: WebSocket, currentTarget: WebSocket, eventPhase: 2, …}
VM52:1 WebSocket is already in CLOSING or CLOSED state.
(anonymous) @ VM52:1
setInterval (async)
(anonymous) @ blabws.php:435
VM52:1 WebSocket is already in CLOSING or CLOSED state.
如果您能在此问题上有所作为并帮助我解决问题,我将不胜感激。