Call webpage on Home assistant without router NAT setting

Hi,
Is there a way to have an interactive webpage called (hosted locally on HA) from HA?

I have the Unify addon installed, but haven’t opened ports in my router to make it available outside. I am now away from home and have access to HA, but I had to re-install Unfiy post the latest update as it became unavailable (I have this issue often unfortunately). Now I cannot reach the setup page to set the addon up as I have not forwarded port 8443. Is there a way to still do this?

I tried the webpage card, but it could not open the page https://192.168.1.52:8443… I suspect lovelace is using the connection from the resource calling the page, not the server hosting HA.

I’m running HomeAssistant OS, latest version.

This?

Tried that too before posting but same result…

I did try again. I suspect the “issue” is the lets encrypt certificate. Normally when I go to the page from within my LAN, I get the certificate error and then through advanced settings in Chrome I proceed.

Now it just gives me a page 192.168.1.52 took too long to respond.

When going through the CLI interface, I am able to get the page through WGET using the
–no-check-certificate option.

I would think there would be a way as I am within the network… anyone has a brilliant idea? if not, I just have to wait until I am back home…

A bit confusing.

You want to access the page from outside your LAN, right?
If so, whatever with a “192.168.x.” address won’t work.

I guess the wget you tried was via SSH? If so, you are actually doing it from the HA machine, not from the outside, because the ssh is from the outside to HA.

Thanks Chris.

I am able to access my HA instance remotely through the duckdns - lets encrypt addon. I also have the terminal / SSH addon to allow me to be on the local machine and SSH into for example the access points like I would be on the LAN (as I am calling it from the HA instance).

As i just re-installed the unifi addon, I need to first configure it to be able to access it through the unify cloud portal. To do that, I need to go to the https://xxxxxxx.duckdns.org:8443/ (won’t work as I have not forwarded the port in my router) or https://192.168.1.52:8443 which is the webpage of the unifi addon on my HA instance. This is what I am trying to achieve.

I have been seeing if there is a custom component web browser or way to get the iframe to work, but as said I fear the security from the certificate is preventing going locally to that page).

You won’t succeed without a reverse proxy in front of the Unify UI.
An iframe just embed a page in another one, but the browser with still use the “192.168.x.x” address to fetch the inside page, which won’t work outside your LAN.

If you have SSH access, can’t you just use SSH port forwarding?

1 Like

hmm… I guess I have a lot to learn here. I am able to SSH into the HA instance, so theoretically I should be able to do SSH portforwarding, but I fail to see how that would take me to my goal? I can portforward 8443, but where do I forward it to and how does that ensure I can access it?

ssh -L 8443:192.168.1.52:8443 [email protected]
Then open your browser on https://localhost:8443 to get the unify UI.

1 Like

hmm… so even if I am within the network, the browser is outside the LAN and would use the browser’s LAN to determine the 192.168.x.x address?

I guess I was thinking this all would be simple, but it’s not really showing to be that way :slight_smile:

Within what network?

You’re super confusing :wink:
Are you able to SSH from outside your LAN to your HA (or anything in your LAN, really)?
If so, you can use SSH as a “jump” tunnel to reach the UI (or anything, really) inside the LAN.

Im sorry to be confusing… I try to be as clear.

I can do the following:

  1. I can SSH remote into my home assistant instance (using Putty / winSCP for example). Like that I can get to the files or command line interface from a remote location. I do use user root.
  2. I can also use the normal web interface, call the addon terminal / SSH (GitHub - hassio-addons/addon-ssh: SSH & Web Terminal - Home Assistant Community Add-ons) that gets me to the command line interface which is the same as 1).

if I would use your suggestion “ssh -L 8443:192.168.1.52:8443 [email protected]”, would I enter that in the CLI interface in 2? e.g. “ssh -L 8443:192.168.1.52:8443 root” and then from my current PC (remote) not sure how me calling port 8443 would work as the router won’t let me through on that port if I call from my current PC.

You would do that in putty

That will create a tunnel inside your SSH connection.
It will map the local PC port 8443 to Unify 8443 through SSH. The PC will not talk to 192.168.1.52, the SSH server on HA will.

Ahhh!! This makes sense!! I’ll give it a shot in a bit!
Learning new stuff every day is cool!!!thanks for your patience!

Guess I am lost again. I’m able to get the connection working as you say, but then I’m in the CLI interface as expected of the home assistant instance. How can I then trigger the webpage to open? Calling it from the remote PC doesn’t work, but from the command line I can’t trigger the opening of a webpage…

That should work from your PC browser…
What does it say?

these are the settings as you suggested:

Dont’ know.

if curl -kv https://192.168.1.52:8443 works in your ssh shell, it should work through the browser as well.
It could be that the HA ssh server disabled tunnels, but it would be surprizing.

It is what it is. Thanks for the help and the patience!