I'd like to use a real URL instead of localhost
for local development (so I can make my development environment more similar to production, not have to remember which port is associated with which service, and have valid certs).
I added an A record to my DNS records for my domain (*.myname.example.com -> 0.0.0.0
), but I'm getting a "refused to connect" error; do I need to change something on my machine (e.g. I tried adding the same mapping to /etc/hosts
)? I similarly tried an A record to 127.0.0.1
and a CNAME to penguin.linux.test
(this resolves to 0.0.0.0
on my host, see below for my setup which has this /etc/hosts
rule by default).
For more context (i.e. why editing /etc/hosts
is insufficient), I can't actually edit /etc/hosts
on my machine, only on the VM my code is running in. More specifically, my stack is below.
- ChromeOS host
- Crostini Arch linux container
- Traefik docker container that routes subdomains to the appropriate services
To resolve any ambiguity about the root of the problem being more fundamental, this works perfectly well if I set my DNS rules to an A record that points to my external IP address (when I'm on a network that allows port forwarding, which isn't always the case, another reason I'm trying to use localhost
/127.0.0.1
/0.0.0.0
).
/etc/hosts
. The host's/etc/hosts
file, however, is dynamically updated to reflect the container's IP address (atpenguin.linux.test
). I have confirmed that if I manually add an A record in cloudflare*.myname.example.com
->100.xxx.xxx.xxx
(container's local IP) it all works. However, if I replace that A record with a CNAME*.myname.example.com
->penguin.linux.test
it fails (** server can't find test.myname.example.com: NXDOMAIN
fromnslookup
).