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!

New contributor
bakson is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

bakson is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.