Deployment of SignalR with nginx

At the beginning of the semester, I took software engineering course which has a term project. It requires us to do real-time web application. After discussion with team members, we chose ASP.NET Core with SignalR. While I was writing this story, SignalR is on alpha stage (1.0.0-alpha2). Therefore, it has issues. Such as, the documentation is incomplete, some of the features are under development and there is no information about unit testing or functionality testing etc. Of course, somehow you can achieve those things, no doubt, but you have to work hard. In this story, I will mention about deployment of SignalR with nginx.


Two months after we completed the project with a few shortcomings such as link. Then, we had to deploy the project. I followed this documentation, app was working but the SignalR part was giving me this error


If we look behind of the problem, it is based on headers of connection.

If you need to create a WebSocket connection from scratch, you’ll have to handle the handshaking process yourself. After creating the initial HTTP/1.1 session, you need to request the upgrade by adding to a standard request the Upgrade and Connection headers, as follows: Connection: Upgrade Upgrade: websocket

Source Mozilla

The deployment documentation sets the connection header as keep-alive. And, WebSocket does not working with keep-alive. In our project, SignalR Hub is mapped to “/api/chat”. So, we have to add a new location and set the connection header as “upgrade

This configuration solves the problem. Also, our term project github page is shown below.

Thats all, thanks !

ITU. CE. LCWaikiki

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store