Ingress with Custom URL?

I wanted to expose some server on the network as well through ingress and managed to write a small add-on that uses a nginx reverse proxy server to provide an “ingress-ready” view of the resource. You can install it from here: https://github.com/tux2000/home-assistant-addons

Nginxproxymanager can do this with as many subdomains as you want while only exposing 80 and 443. 80 strictly for https(443) redirect. 443 for the https reverse proxy. To whichever backend IP and ports

Then use Adguard or other DNS service to prevent internal connections to fqdn’s from going out to the internet to be routed back in.

Then you can use the same fqdn Internally and externally

Hi,
I tried to install your addon but it failed on my HassOS setup.

Failed to install add-on

The command ‘/bin/bash -o pipefail -c apk add --no-cache nginx=1.22.0-r1’ returned a non-zero code: 1

Great that this seems useful to you, @Mincka, and sorry that it did not work. Could you please open an issue at Issues · tux2000/home-assistant-addons · GitHub with more details so that i can have a look at it?

1 Like

Actually, I think i fixed it. Could you try installing version 0.2.1 ?

1 Like

Thank your for your reply. I can confirm I was able to build your addon.
I tried to access a few websites on my LAN but it seems there are few incompatibility issues.

I tried the following sites:

  • OpenWRT web interface (Luci): does not load at all. 403 error on cgi-bin/luci/. Maybe it’s related to source IP restrictions that are not seen coming from lan, I need to investigate.
  • Proxmox VE: does not load at all (actually only HTML). The browser attempts to load resources directly on root path (https://xxx.ui.nabu.casa/proxmoxlib.js?ver=3.5.1), so 404 errors and unable to load the interface.
  • Frigate NVR (just to test since it’s useless because of Frigate Proxy addon): Broken interface but few images loaded. I saw this in the container log:
ws4py.exc.HandshakeError: Header HTTP_UPGRADE is not defined
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/ws4py/server/wsgiutils.py", line 101, in __call__
    self. Result = application(self. Environ, self.start_response)
  File "/usr/lib/python3.9/wsgiref/handlers.py", line 137, in run
    raise HandshakeError('Header %s is not defined' % key)

Some JS seems to load ok on some paths, but others don’t:
OK (200) https://XXX.ui.nabu.casa/api/hassio_ingress/LyrTBcff_mAd7UwYSYlIAJzQxqqfzI-mH_DbSKOttuQ/assets/index.e8c171d2.js
NOT OK (404) https://xxx.ui.nabu.casa/api/hassio_ingress/LyrTBcff_mAd7UwYSYlIAJzQxqqfzI-mH_DbSKOttuQ/api/hassio_ingress/LyrTBcff_mAd7UwYSYlIAJzQxqqfzI-mH_DbSKOttuQ/assets/vendor.153a2319.js

  • Portainer: After a initial long loading (it looked like looping resources loading), it managed to load and it works perfectly fine. :+1:

I don’t know if it’s possible to build a universal ingress proxy because of the specifics of each application. However, I am already happy so see that Portainer works great.

Do you prefer individual issues for each site on GitHub or just a single one?

necro, we need working links into frigate proxy, Fix.

Thanx for writing this addon. I couldn’t find other examples how to use ingress with addons in HA. It is really useful. It doesn’t work though when using forms for my addon

1 Like

If certain targets dont work, it might be due to other places of the html needing an edit than the ones i am handling. The filters are defined in home-assistant-addons/direct.gtpl at ef50dd6a0067f39cf6b4ae96514954bbedd9b069 · tux2000/home-assistant-addons · GitHub and maybe you can extend with more cases that are needed in your use case @mspiridakis and @Mincka
If you fix your use cases, feel free to send a pull request.

1 Like

That helped a lot.
Thanx again

Just found this, been looking for a way to do this for a long time.
Is there a way to add multiple instances of this addon with different names? I’m running two home assistant instances and need additional ways to access the second HA addons from the primary instance.
Also, accessing Webmin through here would be awesome.

If possible, it would be great if there were additional Destination: line items in the config, as well as sub-urls for the proxy to allow for multiple proxies. This would allow people to add custom panels.

For instance, I’m in the process of migrating my adguard from one HA instance to another, but I have both running at the same time rather than a solid cutover. I’m using your addon and just relabelled it in my config:
image

panel_custom:
  - name: adguard_server_con
    sidebar_title: Adguard Home 2
    sidebar_icon: mdi:shield-check
    js_url: /api/hassio/app/entrypoint.js
    url_path: '8e1c3c73_ingress_proxy/dashboard'
    embed_iframe: true
    require_admin: true
    config:
      ingress: core_configurator

I just set this addon up and tried to direct it to my router IP address (192.168.0.1) however it looped back to HA (192.168.0.14). I can’t get it to view any other IP address, they just give me “502 Bad Gateway”. Any ideas?

This is more complex than what i am using this plugin for. If you have a chance to add such functionality i would welcome a pull request to the repo :slight_smile:

Not sure exactly what is going on. Some routers might be trying to be “smart” and e.g. breaking out of the iframe that is used for ingress. How do you specify the destination of the redirect? Do you use protocol and port, e.g. http://192.168.0.1:80 ?

I use it to embed paperless-ngx into the HA UI which is running on another port of the same server. Is that working for you?

I used 192.168.0.1:80 for my router. I also tried 192.168.0.15:80 for my NAS. I didn’t use any http// etc, just the IP:Port.

I’ll try getting it to pick up another port on the HA server

EDIT: I just tried directing to another port on teh HA machine and that worked… I did include the http:// this time. I tried with http:// to other IP’s but no luck.

Not sure what it depend on then. But if you figure out what is going on make sure to feed back so that we can make this plugin more useful.

Check my first add-on, Firefox in HA. :slight_smile:
I made it so I can browse any site from my home network directly in HA.

4 Likes

Try this integration GitHub - lovelylain/hass_ingress: Home Assistant Ingress function without Hass.io . I had the same need 2 years ago, so I extracted the ingress function of Hassio into a separate integration, and continued to make some optimizations based on my own experience.

2 Likes

Thank you very much on this integration. I just testing this thing out and this is really working on my system.
I’m running docker installation and was banging my head around on how to access some containers using nabu casa.
I just tested this on my mobile phone using cellular network and android app to access my ha. I was able to access my containers that i set up using this integration.
Thank you very very much again.