Dashboard Access via Reverse Proxy


#1

Hi folks,

I just got my Hubitat and have been enjoying setting it up. I'd like to allow direct access to my hub via an Apache reverse proxy with client certificate authentication that I use. It works and I can connect to the main interface, but when I try to pull up a Dashboard, the interface tries to pull an iframe from the internal address rather than the URL I'm calling from the browser (which fails for obvious reasons).

Is there any way to get the dashboards to pull from the requested domain name rather than the internal address?

-Justin


#2

I think you'll have to use the cloud link for the dashboard.


#3

I did give that a try (in desperation, since I really don't want to have to rely on external servers to bounce a connection back to my own). All I got was an Internal Server Error from Hubitat's servers. Probably a temporary failure.

But that's fine. There's no reason that should be necessary. At best I would think some links need to be changed to relative locations and at worst it seems like there might need to be a configuration item to tell the system, "use this domain name for URLs."


#4

It almost works if I just browse to the local IP address, open the dashboard to get the full URL, and then just change the http ://192.168.x.x address to my https ://domain.name proxy. But there's clearly some AJAX stuff going on in the background that's failing (the problem indicator in the upper right flashes between green and red). And actions have delayed or inconsistent responses. They do eventually work, but may stick at "sending" for a while before updating.

So it seems that it's really close to being proxy-friendly - I just need a way to prod it into using the right scheme and hostname for those JS requests.


#5

Actually seems to be the websocket. I'm not familiar with the way it's being called (e.g., it doesn't seem to be trying to access wss:// or ws://) and the proxy isn't passing along the "101 Switching Protocols" messages for some reason. :frowning:


#7

Okay, this seems to have done it for me:

ProxyPreserveHost On
ProxyRequests Off
RequestHeader unset Referer

ProxyPass /eventsocket ws://192.168.1.1/eventsocket
ProxyPassReverse /eventsocket ws://192.168.1.1/eventsocket
ProxyPass / http://192.168.1.1/
ProxyPassReverse / http://192.168.1.1/

All the connections are succeeding now and the interface seems to be responsive, so yay! Would still be great to be able to launch the dashboard from the main interface (i.e., I have to manually change the URL to make it work with the correct external domain name), but that's a small issue.


#8

Not following, the iframe /dashboards loads a relative URL. Or are you talking after the dashboard menu loads, not being able to open specific dashboards?


#10

Doesn't seem to. I tried to post images, but this site apparently won't allow it.

Regardless, I go to "https:/ /hub.x.x" and access the admin site. From there, I go to Dashboards and click the only dashboard I have. It then gives me a warning saying that it's trying to load from https:/ /192.168.x.x - the internal address of the Hubitat. Note that it's keeping the HTTPS - just switching the host portion of the URL.


#11

So its not the dashboard menu / iframe, its a dashboard link after the menu loads in the iframe then.

The embedded / iframed dashboard menu serves a few different roles which makes changing this a non trivial task.