0

I have an ASP.NET Core web app which is using signalR hub to communicate with clients. I'm hosting this on Raspberry Pi 2 with nginx reverse proxy.

The app is working on localhost port 5000. I'm using nginx reverse proxy, but for some reason it is not working on port 80. Any other port redirects to web app except port 80 which returns 404.

The other problem is that depending on "proxy_set_header Connection" parameter my logging in or signalR hub is not working. With Connection set to "Upgrade" hub is working, but I'm unable to log into the service (after entering credentials I'm being redirected to home page and I'm not logged in) and when it is set up as keep-alive then I am able to log in, but I can't send anything through the hub.

I'm using default Identity generated by Visual Studio 2019.

My /etc/nginx/sites-available/default settings:

server {
        listen 5123;
        server_name _;
        location / {
                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;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;
        }
}

server {
        listen 80;
        server_name _;
        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;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;

        }
}

I can't find any solution with google. Please help!

2
  • What happens if you use proxy_set_header Connection $http_connection;? Feb 24, 2020 at 3:44
  • 1
    Yes, it helped. Now both authentication and signalR are working. Thanks!
    – bakson
    Feb 26, 2020 at 18:41

0

You must log in to answer this question.

Browse other questions tagged .