Citrix NetScaler – WebSocket

I enabled the WebSocket on Citrix Netscaler after starting up Developer mode in Google Chrome I noticed right away that I was getting some websockets timeouts.

WebSockets Connection to “ws://” failed error during websocket handshake: Unexpected response code 404.


I noticed pretty quickly that it was the NetScaler which was not allowing WebSocket connections as part of of the virtual server that I had configured.

Now there are something that you need to be aware of, WebSockets is not equal to HTTP, it is an entirely different protocol, so in my case I had configured a HTTP based load balanced vServer which of course did not regonize the websocket request that my client made to the Rancher Master server.

Now this is of course something that is easy to fix on a NetScaler. First we need to configure a HTTP Policy, which is found under System –> Profiles –> HTTP Profile, the easiest thing is the mark the default profile and click add.

Inside the profile settings window, there is only one setting we need to define


That is the “Enable WebSocket” connections, which allow WebSocket connection over HTTP based vServers. After we have created this HTTP profile we just have to bind it to a virtual server.

Go into Traffic Management –> Load Balance –> Then into the virtual server we want to enable websockets, and click edit. Choose Profile on the right side and click edit on HTTP profile


And voila you are done! WebSockets is now enabled over existing HTTP load balaced virtual servers.(Note: Storefront HTML5 based Citrix client also uses WebSockets)