iOS official app and Safari fails to login

Just had this problem crop up: on iOS when logging into my HA instance - I manually type the URL of my HA and I get a Safari window which gives the error:

Safari cannot open the page because it could not connect to the server.

I’ve granted permissions to talk to devices on my local network.

If I try outside of my network, I get this error:

NSURLErrorDomain - 1020

I can also see that if I use Firefox on the same device, I can access the HA web UI just fine. However with Safari, I get strange issues where it’ll either refuse to connect entirely - or load some assets (images) but can’t access the API.

I’ve tried deleting the cache from Safari - no difference.

I’ve tried enabling and disabling Location services (which apparently makes a difference) - it didn’t help.

I’ve tried disabling Limit IP Address tracking on my wifi.

I’ve tried checking that Private Relay is disabled - it is.

One thing to note is that I have split DNS - so outside of my network the hostname it points at my public IP, but inside it points to the server itself. I don’t know whether this is confusing Safari somehow.

At this point I can still use Firefox to access it, but that’s not ideal.

Any ideas?

The error code -1020 means “data is not allowed.” You likely have cellular data turned off for the Home Assistant app and you’re trying it off Wi-Fi.

Without the error message that’s happening when on Wi-Fi, it’s hard to know for sure. You may find the error messages for this screen improved in 2023.2, currently in beta. Given you’re using split DNS, I’d guess it’s pointing to the wrong internal IP address. Check your server config for what internal URL it’s sharing, too.

That was the message when I was on Wifi :exploding_head:

As it turns out, it was because of this: Ios14 connection issue on local network

My internal DNS zone had my hostname as an A record, but the external DNS zone was a CNAME. This apparently causes a bug in iOS that prevents me from connecting.

I fixed it by setting my external Zone to be an A record as well, and now it all works as expected.