peterldowns / localias

custom local domain aliases for local dev servers
MIT License
605 stars 3 forks source link

failed to start mDNS server: no such host #34

Closed Flusinerd closed 1 month ago

Flusinerd commented 2 months ago

Hello, I have have issues when running on my home network. I have a FRITZ!Box home router and therefore devices have the hostname:

.fritz.box This gets assigned by the routers DHCP. When I start localias I get an error: ``` replacing existing daemon on pid 65321 2024/08/26 14:53:20.934 INFO admin admin endpoint started {"address": "localhost:2019", "enforce_origin": false, "origins": ["//localhost:2019", "//[::1]:2019", "//127.0.0.1:2019"]} 2024/08/26 14:53:20.934 INFO tls.cache.maintenance started background certificate maintenance {"cache": "0xc000564080"} 2024/08/26 14:53:20.939 INFO http.auto_https server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS {"server_name": "srv1", "https_port": 443} 2024/08/26 14:53:20.939 INFO http.auto_https enabling automatic HTTP->HTTPS redirects {"server_name": "srv1"} 2024/08/26 14:53:20.950 INFO pki.ca.local root certificate is already trusted by system {"path": "storage:pki/authorities/local/root.crt"} 2024/08/26 14:53:20.950 WARN tls unable to get instance ID; storage clean stamps will be incomplete {"error": "open /Users/jan/Library/Application Support/Caddy/instance.uuid: no such file or directory"} 2024/08/26 14:53:20.950 INFO http.log server running {"name": "srv0", "protocols": ["h1", "h2", "h3"]} 2024/08/26 14:53:20.950 INFO http enabling HTTP/3 listener {"addr": ":443"} 2024/08/26 14:53:20.951 INFO http.log server running {"name": "srv1", "protocols": ["h1", "h2", "h3"]} 2024/08/26 14:53:20.951 INFO http.log server running {"name": "remaining_auto_https_redirects", "protocols": ["h1", "h2", "h3"]} 2024/08/26 14:53:20.951 INFO http enabling automatic TLS certificate management {"domains": ["trackr-api.local", "bytebase.local", "trackr-app.local"]} 2024/08/26 14:53:20.970 WARN tls storage cleaning happened too recently; skipping for now {"storage": "FileStorage:/Users/jan/Library/Application Support/localias/caddy", "instance": "922d366f-4491-49fa-83cf-1cd9da747a51", "try_again": "2024/08/27 14:53:20.970", "try_again_in": 86399.999999435} 2024/08/26 14:53:20.970 INFO tls finished cleaning storage units failed to start mDNS server: could not determine host IP for .local domains: lookup MBP-von-Jan.fritz.box.local: no such host ``` The problem probably is, that it adds a .local suffix to the routers provided hostname and therefore cannot resolve it. ``` ❯ nslookup MBP-von-Jan.fritz.box Server: 192.168.178.1 Address: 192.168.178.1#53 Name: MBP-von-Jan.fritz.box Address: 192.168.178.24 ``` ``` ❯ nslookup MBP-von-Jan.fritz.box.local Server: 192.168.178.1 Address: 192.168.178.1#53 ** server can't find MBP-von-Jan.fritz.box.local: NXDOMAIN ``` Output of `debug config --print` ``` # localias config file syntax # # alias: port # # for example, # # bareTLD: 9003 # serves over https and http # implicitly_secure.test: 9002 # serves over https and http # https://explicit_secure.test: 9000 # serves over https and http # http://explicit_insecure.test: 9001 # serves over http only # trackr-app.local: 61000 trackr-api.local: 61001 bytebase.local: 62000 ``` Sincerely Jan
peterldowns commented 1 month ago

Thanks for writing in — this is indeed a problem, I can reproduce by setting my computer's hostname to MBP-von-Jan.fritz.box (even though my router doesn't have a DNS server like your Fritz!Box setup does.) I think I have a fix, I will share a branch shortly.

peterldowns commented 1 month ago

@Flusinerd can you try using a localias binary downloaded from this release page and seeing if your problem is fixed?

https://github.com/peterldowns/localias/releases/tag/2.1.0%2Bcommit.fcaac03

peterldowns commented 1 month ago

Ok, I’m pretty sure the PR above fixes this issue (based on being able to repro myself) so I’m marking this as closed. If for some reason it turns out I didn’t fix your problem, I’ll re-open.

Flusinerd commented 1 month ago

Hi @peterldowns Sorry for the late reply. I had time to test this in the setup where it failed and can confirm it now works without any issues.

Thanks for the quick fix and awesome tool :)

peterldowns commented 1 month ago

@Flusinerd no need to apologize, I’m glad to hear the problem is solved! Thanks and I hope you enjoy!