Search code examples
nginxsignalr.clientasp.net-core-signalr

Server is not responding to ping of client


i have a react native application which is use signalR communicated with .net core 2.1.

There is not any error with socket connections. Works well all of things. But server can't respond the pings of client and returns 504 to client. When returns 504, client's connection close. Handled at hubConnection.onClose() . Then client needs to reconnect.

The proxy_read_timeout can setting to high milliseconds. But its messy.

So i can't use keepAliveInterval efficiently on client.

nginx conf settings;

            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 configure on server;

        app.UseSignalR(routes =>
        {
            routes.MapHub<MyHub>("/myhub");
        });

nginx response(504) as below

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" "-"

i can't understand why server does not respond the ping of client?


Solution

  • AWS security groups block ICMP (including ping, traceroute, etc.) by default. You need to explicitly enable it.

    https://serverfault.com/questions/511738/why-cant-i-ping-my-freshly-set-up-amazon-web-service-ec2-instance#:~:text=by%20default.,need%20to%20explicitly%20enable%20it.&text=You%20need%20to%20add%20a,and%20click%20%22Add%20Rule%22.