NSURLErrorDomain - 1004

I’ve been way from home for 3 weeks working on a job. The iOS app works fine when I’m on 4G, but now when I’m back home on my own WiFi I get the red banner error message:

Could not connect to server.
NSURLErrorDomain - 1004

There have been a handful or Home Assistant updates I’ve done remotely whilst I was away, so I’m not sure what the problem is. I read changelogs before upgrading anything and I don’t recall seeing anything that gives this error.

Any ideas what the problem is?

1 Like

Same thing started happening to me this morning. When I try to connect over wifi I get the same error but over 4G I get NSURLErrorDomain 1200 ssl error. I haven’t installed any updates to home assistant.

Edit: My problem got resolved automatically. Was probably a DNS issue with HA Cloud :man_shrugging:

Same problem here… but I get the problem either by 4G or home wifi… any recommendations??

Mine isn’t resolved still. However, if I use a VPN then access is fine. It’s my home network access. Which I find very odd. On home wifi, I get the error. Connect via 4G/3G or VPN, and the issue is resolved.

Hi,
I was curious, so googled around for the 1004 error and found the following:
https://developer.apple.com/documentation/foundation/1508628-url_loading_system_error_codes/nsurlerrorcannotconnecttohost

Hi. I’m having the same issue, getting 1004 though. I was using duckdns with no issues then seemingly out of the blue this started. I’ve had my isp involved trying to help but with no luck. Other port forwarding is working, only hass isn’t. Seems as though my hass device is refusing the connection. Everything works internally on Wi-Fi or lan cable.

I e been at this for a few days and today I decided to try the cloud/nabu casa. It’s working but it’s slower than duckdns. So how is that the cloud url is accepting but not the redirect/port forward?

How do we fix this issue?

Edit:
My issue is specifically on remote access, local/internal access is 100%. Nabu casa is painfully slow.

Same problem here … Andy ideas?

I dont know what caused the problem but i was able to view home assistant on a computer with local ip adress. I enabled home assistant cloud trough nabu casa and with the cloud link i was again being able to view home assistant on all devices, internal and external

Here also, since a few days. Before everything worked like a charm.

Using duckdns, letsencrypt.

Same issue here! No local access and can’t ping the Home Assistant server… if I do a hard reset it works for a while

2 Likes

Was experiencing 3 to 4 connection errors per day, which I could only overcome by hard restarting my PI4

Today I restored a snapshot (this started occurring after updating to core-2021.8 and/ or updating my Google WiFi configuration on config.yaml)… so far so good (been 2h already) :crossed_fingers:

I had a stupid mistake that caused this issue… My router does not support loopback so I use the DNSmasq add-on to help connect from my local network (might be the same issue for those not able to connect locally but able to connect remotely). I hadn’t noticed my phone switched to my long-range WIFI extender I use for a specific area a couple hundred feet from my house, which I did not have my DNSMasq DNS server setup on. This caused this issue. My mistake, switched back to regular wifi with the DNS server set properly and all is well again. So either look into using DNSmasq if your router doesn’t support loopback, and/or make sure your proper DNS server is set if you are using this.

I have the same Problems since months… sometimes every day, sometimes once a week… HA is not available and i got the message “could not connect tot the server NSURLErrorDomain - 1004”.
And then no devices work. Only a hard reboot helps. This made me sad… don’t if my raspi is broken or HA is not ok…

2 Likes

+1 - started happening today. Turns out I had my phone connected to my extender, which is isolated from the network. No clue why it would cause this, as it should still resolve DNS normally, but apparently tried to route the request to a local address, somehow.

Same here. Ping via VPN to machine is okay. However no app, no web interface is working. No clue what happened

Same here…

Solved for me: ssl certificate was outdated. Doh.

I can ping my raspberry pi but i can’t connect to home-assistant. I try it via browser, app or ssh.

Hey,
i had the same issue for weeks. This solution worked for me:

  1. I used Pi Hole (on another Pi) and set it up to the main DNS-Server in my Router (i think it will be also possible with other tools like dnsmasq or freetz).
  2. I open the /etc/hosts file in the Pi hole Pi (login via ssh and type: sudo nano /etc/hosts).
  3. And add the following line: HOMEASSISTANT-IP:HA-PORT EXTERNALDOMAIN.duckdns.org

for example:
192.168.110.123:8123 domain-home-assistant.duckdns.org

Important was to add the Port at the end of to the IP. Without it won’t work.

i had the same problem. after turning off my location service on my iphone, the problem was no longer there for me. I don’t know why this problem occurs, but turning it off solved it for me.