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.

68747470733a2f2f6265656d6170702e73332d65752d776573742d312e616d617a6f6e6177732e636f6d2f37306233626166312d653132662d346530642d396664612d6638373233386338643333652e6a7067.jpg

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

websockets.PNG

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

websockets2.PNG

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)