I just came around an issue publishing home assistant to the internet not working with netscaler. When browsing to the home assistant url from behind a reverse proxy, the login screen appears. After logging in succesfully the following message appears: ” Unable to connect to Home Assistant, Retry”

After doing some research I found other people are complaining about this since 2017. None of them are getting this to work, not with netscaler or using other reverse proxy solutions like NginX or Apache.

The problem is that Home Assistant is using WebSockets. WebSockets is not equal to HTTP. WebSockets is used for making interactive connections form the webserver to the user and to display live events.

 

When using a Netscaler the netscaler does not allow websockets to a load balanced virtual server by default. It has to be enabled by a http profile. After it has been enabled the Home Assistant reverse proxy works like a charm.

How to enable Websockets on a load balanced virtual server:

In Netscaler gui, go to System / Profiles / HTTP Profiles

The easyest way is to select the current nshttp_default_profile and click Add.

Give it a name, for example “nshttp_default_profile-home_assistant” and select “Enable WebSocket connections”

Select Create.

Now go to the load balanced virtual server for Home Assistant. Select the just created profile and click on Ok and Done.

That’s it. You have a working Home Assistant connection by using Netscaler as a reverse proxy.