Solution:
Root Cause: Lack of Local mDNS/DNS Name Resolution in Connector Runtime When
cloudflared is configured to forward requests to a non-FQDN or internal hostname (e.g.,
http://myserver.local:3000 or
http://intranet-web), the underlying OS resolver invoked by Go's
net.Dialer attempts to query standard system nameservers. If the host lacks a configured mDNS responder (like Avahi/Bonjour) or lacks search domains in
/etc/resolv.conf, the resolution fails instantly with
dial tcp: lookup myserver.local: no such host, resulting in a 502 response.
Diagnostic Verification: 1 Check cloudflared system logs:
Copy
bash
journalctl -u cloudflared.service -e | grep "no such host"
2 Test resolution directly using the binary's runtime environment:
Copy
bash
getent hosts myserver.local
If this command returns null while
ping works via mDNS, systemd-resolved or glibc NSS switch settings are restricting Go's static CGO resolver.
Step-by-Step Fix: 1 Update Ingress Config to Use Static IP Addresses:
Replace hostname references in config.yml with static LAN IP addressing: Copy
yaml
ingress:
- hostname: app.yourdomain.com
service: [http://192.168.1.50:3000](http://192.168.1.50:3000)
- service: http_status:404
2 Configure /etc/hosts Local Map:
Add a static mapping entry on the machine running cloudflared: Copy
bash
echo "192.168.1.50 myserver.local" | sudo tee -a /etc/hosts
3 Restart cloudflared Service:
Reload service state: Copy
bash
sudo systemctl restart cloudflared
Prevention & Long-Term Monitoring: Ensure local network services use static IP reservations via DHCP leases or static DNS records in local resolvers (Pi-hole, AdGuard Home, or Windows Server DNS).