We all know and dearly love Nginx. One very common way to use it is to put it in front of some other application server such as Tomcat, Node, or Tornado as a reverse proxy. About a year ago, Nginx got the ability to proxy WebSockets connections to a backend server that supports them.
Proxying WebSockets with Nginx
WebSockets are an exciting new technology designed to make it easier to create real time applications by providing a full-duplex communication channel between the browser and the server. In layman’s terms that means that information can be sent and received by the application at the same time. One of the easiest ways to write apps using WebSockets is to make use of the excellent Socket.io library, which is used in conjunction with Node. The usual strategy when building a Node app is to put Nginx in front of Node as a reverse proxy that serves any static content. This was a problem if you wanted to use WebSockets though, as Nginx didn’t know how to proxy those requests. Until now…