0
votes

I have deployed Asp.Net Core 2 website on ubuntu with Nginx as a reverse proxy. The website works but SignalR doesn't. Same build work locally in IIS-Express. Getting following error in logs, Terminating Long Polling connection by sending 204 response.

Following nginx configuration I am using,

server {
    listen 80;
    location / {
        proxy_pass http://localhost:5000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection keep-alive;
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

I am accessing the server from Xamarin Android. What can be the issue? Any help would be great. Thanks in advance.

1
Try proxy_set_header Connection "Upgrade";Tarun Lalwani
Thanks. If I do this, my POST-APIs doesn't work. I will try again though.Pravin Patil
You may need it on a specific URL location and not the whole /Tarun Lalwani
Ok. Yeah. Will try Thanks.Pravin Patil
Works by adding "Upgrade" for the particular location. Thanks.Pravin Patil

1 Answers

0
votes

You should change you config to add additional path which needs the Upgrade header

server {
    listen 80;
    location / {
        proxy_pass http://localhost:5000;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }

    location /socket/path/ {
        proxy_pass http://localhost:5000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}