Ulrar / hassio-addons

Repo for hassio addons
MIT License
23 stars 10 forks source link

Forked-daapd ingress #14

Open Ulrar opened 4 years ago

Ulrar commented 4 years ago

I'm pushing a first try at ingress. It seems to work pretty well if you're accessing HA directly, as far as I can tell at least.

On the other hand if you're accessing HA through some reverse proxy (I'm using HAProxy on my router with SSL offloading) it's a bit trickier for the websockets, you either need a very long timeout or ideally I might add support for SSL directly into the addon's nginx, that way it could be done with a TCP backend. Not sure how the nabu casa works, I suspect it'll have the same issue. I'm opening this to track it, I'm open to suggestions of course.

I need to play around with it a bit more but in the meantime for people with simpler setup this should work just fine. Please let me know here if you have any problems with it.

GoSpursGoNL commented 3 years ago

First of all, thanks for this awesome addon.

In general it is working fine if I open in the browser: 192.168.0.11:3689 But if via the supervisor I click on 'Open web UI', or via the sidebar, then I get the error:

Failed to connect to forked-daapd 
Request failed (status: 404 Not Found, url: http://192.168.0.11:8123/api/hassio_ingress/WYy0JkD2dIHUvc1IIB7tA0rJH2AW03S0LWD_8aPJrIc//.api/config) 

The url then is: http://192.168.0.11:8123/hassio/ingress/e4ac757a_forked-daapd

For the moment I solved it by disabling the sidebar icon, and manually adding a link in the sidebar to the working url, via: https://www.home-assistant.io/integrations/panel_iframe/

fredrikbaberg commented 3 years ago

I'm also encountering this issue. Through Ingress I see:

Failed to connect to forked-daapd Request failed (status: 404 , url: https://\<redacted>/api/hassio_ingress/\<long string>//.api/config)

I have a reverse proxy (Traefik) in front of Home Assistant, the same issue occurs if I use the IP to access Home Assistant. If I use http://\<IP>:3689 it works properly.

squireblackdens commented 3 years ago

Same issue here. Any resoution?

Ulrar commented 3 years ago

I'm not sure you all have the same issue, but unfortunately most of the web UI depends on websocket connections made over port 3688. For @fredrikbaberg at least, since you mention you're using a reverse proxy, you'll need to configure that port to be proxied as well.

Without a reverse proxy it should work, as long as port 3688 is open on the same IP you're accessing HA through, but there again depending on setups that might be an issue. There's been an update to the web UI since I've made this addon so some of that might be a bit better in the latest version, which I'll need to update the addon to, but I don't really expect it to not be a pain because of those websockets sadly.

fredrikbaberg commented 3 years ago

I'm not sure you all have the same issue, but unfortunately most of the web UI depends on websocket connections made over port 3688. For @fredrikbaberg at least, since you mention you're using a reverse proxy, you'll need to configure that port to be proxied as well.

Without a reverse proxy it should work, as long as port 3688 is open on the same IP you're accessing HA through, but there again depending on setups that might be an issue. There's been an update to the web UI since I've made this addon so some of that might be a bit better in the latest version, which I'll need to update the addon to, but I don't really expect it to not be a pain because of those websockets sadly.

I'm trying to understand the reverse proxy part. I have limited experience with reverse proxy, but am not conviced that is the issue for me. I have Traefik in a separate VM from Home Assistant. There are three ways for me to access Home Assistant: External URL (through reverse proxy), internal URL or LAN IP. I get the same issue through all three methods of access: Request failed (status: 404 Not Found, url: http://\<intenal hostname or LAN IP\>:8123/api/hassio_ingress/\<redacted\>//.api/config). For external URL it's https and no port, but otherwise the same message. If the issue was with reverse proxy, should it not work if I use internal URL or LAN IP?

I've redacted part of the URL, but there are two forward slash there (//.api/config), could the URL be incorrect?