I had the same once I switched to using (internal) domain names using Nginx rather than IP addresses. It would work from outside, where the request was handled by the router and (port) forwarded to the right IP (in this case the server hosting Nginx)
Once on WIFI, it would not work and I got the 1004 error. I fixed it by updating my router’s DNS setting (dnsmasq) to forward all requests for my (sub)domain directly to the Nginx IP address.
Just in case someone has the same problem:
For me iOS had switched the full trust in Settings > General > About > Certificate Trust Settings off at some point, probably because I switched the device. This results in NSURLErrorDomain -1202, but this was the first thread I stumbled upon, so maybe it helps someone remember to check that as well!
I reckon there’s multiple possible causes for this error - but at least one of them appears to be having a (relatively) new iOS feature called “Limit IP Address Tracking” turned on for your home Wi-Fi. Added in iOS 15.2, I think.
Makes sense, given this feature makes Safari route web requests (including when Safari is embedded in an app) through an external proxy server - which obviously won’t have local access to your HA instance.
Happened to me this evening - experienced this error, realised the “Limit IP Address Tracking” feature had somehow been re-enabled on my home Wi-Fi network despite previously disabling it - and error went away when I turned it off again.
You can toggle this setting in Settings → Wi-Fi → tap the (i) icon next to your home Wi-Fi network (and scroll down). You’ll obviously lose the privacy benefits of this feature when on your home network (Google them if curious). In an ideal world you’d be able to exclude a specific domain name (your HA instance’s) on a specific network (your home Wi-Fi) from being covered by the Limit IP Address Tracking feature, but I don’t believe that’s possible.
Signed up to do this post, and I do realize it was started over a year ago. But I thought I would mention what my fix was for this issue. After trying options from others my situation was different, it was working fine over LTE. In the app you have the Internal URL and you have the External URL in the application. I noticed my IP was a 10.10.1.1/24. The app was looking for the Home Assistance instance, on the wrong network. Removed the Internal URL and that fixed the issue.
You could also just add the SSID for the network, so if the IP’s match it will know to look at the SSID.
I could not reach Home Assistant from anywhere, my iPhone, locally from my laptop, nothing worked.
after days of trying this helped. I connected a keyboard and monitor to my low cost NUC.
Just came here to mention that on IOS17, Limit IP address tracking feature (under Wifi) will cause this too. Hope the HA dev’s can figure this out, as that is a clever and good feature from Apple.
I had the same issue out of nowhere. I fixed it by deleting the server on the companion app on my iPhone and then re-adding the server.
No idea why it broke, but this fixed it.