0

I ran across an article that says that the NGINX Ingress supports websockets starting at version 1.3. But this changelog mentions websocket documentation back at version 0.9.

I'm running with NGINX Ingress at version 0.23.0 and I cannot get the websocket client connection to work. It fails because the Connection header is keep-alive instead of upgrade. It looks like the ingress is changing it, because the connection works if I bypass the ingress and go directly to the Kubernetes service. Before I go much further, it would be good to know if this is hopeless with the version of NGINX that I currently have running.

Wytrzymały Wiktor
  • 11,492
  • 5
  • 29
  • 37
cbarlock
  • 105
  • 10
  • 1
    ingress-nginx 0.23.0 packages nginx 1.15.9, so nginx itself supports websockets. I'm not sure you can get Upgrade working without a special config but I believe a `path` to a dedicated ws server should work - https://gist.github.com/jsdevtom/7045c03c021ce46b08cb3f41db0d76da#file-ingress-service-yaml – Matt Jan 31 '20 at 02:05
  • @cbarlock Was the above info helpful? – Wytrzymały Wiktor Jan 31 '20 at 09:29
  • Thank you Matt. I was not aware of the packaging & versioning you mention above. I had found that link you referenced and think I have my Ingress YAML definitions set up correctly. I'm writing in Go using the gorilla/websocket package. I see the request come in, but gorilla rejects it because the Connection HTTP header is set to `keep-alive` instead of `upgrade`. Can you say any more about this "special config"? – cbarlock Jan 31 '20 at 14:19
  • The NGINX Ingress doc says you need to add an annotation for those services that support websockets. I added: `nginx.org/websocket-services: tcs-bvt-eprouter-websocket` And have a service with the name above. I would expect that the Ingress would say "oh, a websocket. It needs the Connection header to be `upgrade`, but that seems not to be happening. – cbarlock Jan 31 '20 at 14:21
  • Have you managed to make it work? – Wytrzymały Wiktor Feb 04 '20 at 08:28
  • I do not have it working yet. – cbarlock Feb 04 '20 at 20:47
  • Have you seen [this case](https://stackoverflow.com/questions/52883653/nginx-ingress-controller-websocket-support)? Looks like the same problem you are experiencing right now. – Wytrzymały Wiktor Feb 05 '20 at 09:15

1 Answers1

1

I found the problem. Our Helm charts were explicitly setting the Ingress annotation nginx.ingress.kubernetes.io/connection-proxy-header to keep-alive. Removed that and all is well.

cbarlock
  • 105
  • 10