Remote Access was working, but suddenly doesn't work outside of my local network

Hello, my home assistant instance was working normally and one day it randomly stopped working entirely outside of my LAN. I have Home Assistant running on a Raspberry Pi 4 with ethernet an connection and Static IP.

I have my own Google Domain configured to my IP address which I’ve verified is still the correct IP address.

I have home assistant configured with Let’s Encrypt and have verified the certificates are not expired. I can access home assistant via my domain URL when I am on the Local network/WiFi. But as soon as I disconnect from my home network I lose the connection and its almost impossible to login to Home Assistant. When I connect to Home Assistant Remotely it does show the Home Assistant Interface and sometimes I get the login prompt but I rarely can get through, although it has happened occasionally. This is only when I’m using the URL.

When I use the direct IP connection (No port) it gives me a redirect URI error, but when I add the port (8123) it will connect and allow remote access as expected. This is the only way I can remotely access Home Assistant at this time.

It was working just fine and randomly stopped working entirely and I just can’t for the life of me figure out what happened. I’ve tried reconfiguring a fresh instance of home assistant with the same results. I’ve reset my forwarded ports, and I’ve checked Home Assistant’s logs. I can see my mobile device trying to connect.

I have searched all over and most of the topics are dealing with DuckDNS and while I know the process is similar troubleshooting this has been hellish. I have tried restarting my router and modem, but it hasn’t seemed to accomplish anything of value. I do have a log of my remote connection accessing the Home Assistant IP at the correct port. So its being directed to the correct place.

Anyone who has any info to help me out would be greatly appreciated. And Thanks in advance.

Static IP internal or external?
Google “What is my IP” and see if that matches what you configured.

My Raspberry Pi IP address is Static, while my WAN IP is dynamic. Either Way my DNS is configured to my current IP address. I can access Home Assistant remotely directly via IP address so that’s for sure confirmed to be the correct IP address.

Use i.e. MYIP.MS to resolve your domain to the IP address it points to.

Does the domain point to the actual public IP address of your home assigned by your ISP?

I don’t know whether Google itself offers such a service but if not just register to a DynDNS service like i.e.:

Once properly configured your domain name will be in sync with your public IP-address which should make your HA accessible through your TLD (of course with properly configured port forwardings on your routers/firewall side. For security reasons best through a VPN).

My domain is configured to the correct IP address and resolves to my Home Assistant instance just fine. Sometimes when I resolve the domain Home Assistant will get stuck on “Initializing.”

It is something with the authentication process of home assistant that isn’t working correctly as it will allow me to see the login page and attempt to login to Home Assistant. BUT Home Assistant will reject the connection if it is coming from outside my LAN. If I’m on my LAN it will accept my login credentials and log me in but as soon as I try the same information on my phone using my carrier’s internet and not local Wi-Fi it will deny the login, with the above photograph showing the typical login failure. I don’t have IP ban on, so it’s not that.

Maybe this helps?

I’ve actually seen the article and YouTube video. It’s how I originally setup my remote access in the first place. :joy:

I gave a close friend access to the website and he was able to login to a guest account remotely and even control a light or two. So now I’m even more flabbergasted as to what is wrong with my phone’s connection to the server and why It won’t authenticate on my phone no matter what I try.

And thanks for your help either way, it is appreciated as I’ve spent probably a good 10 hours alone on trying different things to figure this out.

Cache maybe? I have an occasional glitch with chrome doing that but if I close the tab and open a new one it works…
Could also be ip_bans.yaml… If someone else can connect and you can’t then it’s local to you

I’ve cleared the cache on my mobile device and the reinstalled the Home Assistant app as well. The thing that’s bothering me is that it’s inconsistent. Sometimes it will load just fine and allow me to attempt the login process. Other times it will just say “Initializing” where you would normally login to Home Assistant. In both cases it will not let me completely login except for the very VERY rare occasion it has let me get through and even then it only works very temporarily.

I have ip_ban_enabled: false in my Config file to be sure, but I’ve never enabled it in the first place.

I enabled my VPN and was unable to login to the URL but could still login to the direct IP address with appended port. If I type just my raw IP address with no appended port it gives me a redirect URI error as shown here.

remote connection

Just a shot into the dark: What OS are you using? Android or iOS? Maybe the OS of your device is all too ancient?

I use android OS which is up to date. The connection from remote usage is proving to be very random. Sometimes it connects and sometimes it straight up doesn’t work at all and doesn’t even make it to the frontend. Would that point towards a possible router issue?

I just don’t see why it would be so random and symptomatic when nothing is ever really changing.

You wrote that it used to work seamlessly before. Have you tried rebooting the router and/or, depending on your home network the modem/gateway? It might be worth a try.

Alright guys,

Good news. I restarted my router and to no avail, nothing was fixed. BUT then I completely reset my router (Netgear XR500), reapplied the port forward rules, and voila! Perfect remote access. Gotta say I will likely never know what went wrong with the past setup. I hadn’t really touched too many of my router’s default settings aside from the forwarding rules and Wifi creds. But fully resetting it seemed to fix the weird behavior I was getting before.

Thanks for the help everyone. :grin:

1 Like

Just to share a similar experience, ‘suddenly’ accessing HA with local IP works but DDNS address won’t. Gone through most of the same debugging steps.

Long story short, it was the router (Asus AC68).
I had been playing with its NVRAM for parental control automation and over-filled its memory and corrupting port forwarding setting (symptom was my port forwarding rules disappeared and cannot add/save new ones).

Cleaning up the NVRAM fixed my issue :+1:

1 Like

If you’re getting logs of authentication that means you have connectivity, right?
What stopped working?

Can you better describe your network setup (what kind of nats/redirects you do have) ?

Nevermind… just seen you made it work. Good :slight_smile:

1 Like

This sounds like a similar experience to what I was dealing with. It was especially frustrating because the symptoms were intermittent at best and would randomly change slightly. It made troubleshooting a pain. It was as if my port forwarding was “misbehaving” and occasionally taking me down the right path and occasionally doing absolutely nothing at all. Very very strange indeed.