服务器未响应客户端的 ping
Server is not responding to ping of client
我有一个使用 signalR 与 .net core 2.1 通信的 React Native 应用程序。
套接字连接没有任何错误。万事大吉。但是服务器无法响应客户端的ping和returns 504给客户端。当returns504时,客户端连接关闭。在 hubConnection.onClose() 处理。然后客户端需要重新连接。
proxy_read_timeout可以设置为高毫秒。但是很乱。
所以我不能在客户端有效地使用 keepAliveInterval。
nginx 配置设置;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_redirect off;
在服务器上配置 singalR;
app.UseSignalR(routes =>
{
routes.MapHub<MyHub>("/myhub");
});
nginx 响应(504) 如下
2020/12/08 09:11:52 [error] 21#21: *2310 upstream timed out (110: Connection timed out) while reading response header from upstream, request: "GET /myhub?id=isXnVpd94uaaPOPucXS74Q&_=1607412351952 HTTP/1.1", upstream: "http://xx:5000/myhub?id=isXnVpd94uaaPOPucXS74Q&_=1607412351952"
[08/Dec/2020:09:11:52 +0000] "GET
/myhub?id=isXnVpd94uaaPOPucXS74Q&_=1607412351952 HTTP/1.1" 504 160 "-"
"xx/326 CFNetwork/1206 Darwin/20.1.0" "-"
我不明白为什么服务器不响应客户端的ping?
AWS security groups block ICMP (including ping, traceroute, etc.) by
default. You need to explicitly enable it.
我有一个使用 signalR 与 .net core 2.1 通信的 React Native 应用程序。
套接字连接没有任何错误。万事大吉。但是服务器无法响应客户端的ping和returns 504给客户端。当returns504时,客户端连接关闭。在 hubConnection.onClose() 处理。然后客户端需要重新连接。
proxy_read_timeout可以设置为高毫秒。但是很乱。
所以我不能在客户端有效地使用 keepAliveInterval。
nginx 配置设置;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_redirect off;
在服务器上配置 singalR;
app.UseSignalR(routes =>
{
routes.MapHub<MyHub>("/myhub");
});
nginx 响应(504) 如下
2020/12/08 09:11:52 [error] 21#21: *2310 upstream timed out (110: Connection timed out) while reading response header from upstream, request: "GET /myhub?id=isXnVpd94uaaPOPucXS74Q&_=1607412351952 HTTP/1.1", upstream: "http://xx:5000/myhub?id=isXnVpd94uaaPOPucXS74Q&_=1607412351952"
[08/Dec/2020:09:11:52 +0000] "GET /myhub?id=isXnVpd94uaaPOPucXS74Q&_=1607412351952 HTTP/1.1" 504 160 "-" "xx/326 CFNetwork/1206 Darwin/20.1.0" "-"
我不明白为什么服务器不响应客户端的ping?
AWS security groups block ICMP (including ping, traceroute, etc.) by default. You need to explicitly enable it.