I am trying to make a website that would have http functions including http post functions, and also web sockets (such as signalR). I am trying to host this website on an ubuntu server using nginx. Generally the set up is something like this on nginx:
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 $http_host;
proxy_cache_bypass $http_upgrade;
}
}
However, I later found that I need to add proxy_set_header Connection "upgrade";
in order to use websockets. However, adding this line in a .net core project results in all http post requests showing a 400 error as shown here 400 status error when posting form data in ASP.Net Core. Is there a set up that would allow both posts and web sockets?