Very slow front-end loading when on local network

Hello,

For a couple of months I have home assistant running on a rpi3 with the add-ons below.

The problem I have is that the font-end is taking approx. 30 seconds when I connect to my home assistant by https:[domain] on my own WIFI at home. It is almost instant when I connect from outside my house (4g / somebody else’s WIFI) and not connected to my home WIFI.

Any ideas how I can make it load fast when on local network?

Add-ons:

  • Let’s Encrypt
  • Configurator
  • Mosquitto broker
  • Samba share

I do not have duckdns because I have a static IP and my own domain.

How quickly does it load if you use the pi’s IP address rather than the domain name?

Hmm it doesn’t load when I navigate via its IP address. In Chrome I get an ERR_CONNECTION_REFUSED. Maybe that is because of the setting that it uses SSL

That’s strange. I would have just expected a certificate warning because the SSL certificate is for the domain name not the local IP address. You can add an exception for this but connection refused is something else. Are you specifying the correct port as well as the IP address and using https for the IP address?

More recent versions of chrome are moving away from http traffic. If you only use ssl locally, this shouldn’t be an issue, but otherwise this might be the issue you are running into.

make sure it’s http://ip-address:8123 - should load even if it complains about the certificate. The connection refused probably means it’s trying to use https

I tried the local lan IP address and that’s giving me that error. When I try my public IP address, home assistant is also loading very fast! So it is down to: on local network but browsing to public domain, that is when it loads slow. Any ideas?

You still didn’t say if you were using http NOT https with local IP address. The error you report indicates you are using httpS

I didn’t know that it wasn’t clear that I was using https. I tried my local IP with http, still getting ‘ERR_CONNECTION_REFUSED’ in chrome and the public IP on https is complaining about the certificate.

Hmm I only use ssl. It looks like it cost a great amount of time to resolve the domain back to the public IP address, where the request is coming from.

Was there a workaround or solution to this? I have similar slowdowns since I whipped up DuckDns with Lets Encrypt

Unfortunately I haven’t found a solution yet. The workaround I now do is visit home assistant through 4g with my phone while I am in the house… but visiting home assistant with my laptop is only possible using my public IP address instead of using the domain name…

This makes zero sense… this seems like a DNS problem.

I am sorry, I did not mean like it was not accessible. What I meant was that I can only use the public IP when I don’t want the slow loading time. I do not have 4g on my laptop =]

It’s still a DNS issue. The domain is not resolving to the DNS address quickly enough.
You could add the domain to the hosts file (and point to the ip address of course) But this is a DNS problem I think.

I have the same problem; except it is not just the local network login that is slow, it is the entire session. Each command is prohibitively slow when I’m logged in on the local network. But everything is lightning fast if I’m logged in to home assistant remotely/globally (not on my home wifi connection). By the way, I loaded the newest hassos yesterday and finally got DuckDNS/Lets encrypt to work. It is AWESOME, except for that local lag issue which is almost a deal breaker for home assistant. I really wish we could get this resolved.

I wonder if it is related to this similar issue I read about with wifi security cameras:

"One last thing to note. When accessing your camera using your public IP address you may run into a small problem known as NAT Loopback. What this generally means is that if you try to access your camera using your public IP address from the same network the camera is plugged into then you will find that you may not be able to connect. This is fairly normal and it’s quite common for your router to block this kind of traffic.

The only real way to remedy this is to have a router which supports a NAT Loopback function, such as a Draytec Vigor 2600, so the first thing to do is check for that. If it doesn’t then you will have to use your local IP address to access your camera from the local network and use your public IP address to access your camera from anywhere else from the Internet."

I guess I’ll call ATT and see if they can help support me with NAT Loopback.

The other thing you could do is to run the caddy addon which is a reverse proxy and then internally you can run off local-ip:8123 and still have external access via duckdns (can use for internal access as well) This will also let you use a non-standard port as well for HA external access.

It’s incredibly easy to setup and use.

Okey, just for the internet archive. I think I solved it… Brace yourself and have mercy on me :stuck_out_tongue:

In my domain settings at my domain-provider I had two A type registrations. One with my public IPv4 address and one with my pubic IPv6 address. Since I removed the A type registration of the IPv6 address, the problem I have is not appearing anymore.

There was a time I experimented with IPv6 for some reason and this was a leftover.