I was experiencing the same problem with using a netscaler. I solved it by enabeling websockets in a http profile and binding it to the load balanced virtual server. You can read my post on how to get it working with netscaler:
https://www.connectix.nl/using-home-assistant-with-reverse-proxy-netscaler/
I think it can be solved with nginx or apache in a similar way.