nextcloud-docker-dev icon indicating copy to clipboard operation
nextcloud-docker-dev copied to clipboard

Use `XXX.localhost` instead of `XXX.local`

Open provokateurin opened this issue 2 years ago • 5 comments

XXX.localhost is set up on most linux systems to already resolve to 127.0.0.1, so adding the record to /etc/hosts would no longer be needed. Of course this can be changed in the env file, but I think this is a more useful default setup.

provokateurin avatar Mar 25 '23 10:03 provokateurin

Good point. Let's change that for new setups.

juliusknorr avatar Mar 27 '23 09:03 juliusknorr

I migrated my dev setup from .internal to .localhost a while ago and really like it! No longer dealing with /etc/hosts is a relief.

This week, I wanted to access my dev setup from a virtual machine and therefore created a Host-Only network. Host got 192.168.56.1 and guest 192.168.56.3. Inside the guest, I added an entry 192.168.56.1 server.localhost to the hosts file. Ping for server.localhost worked and also showed the right ip address, but Firefox and Chromium wouldn't open the page.

The reason is that most browsers and also newer curl versions added a special handling for localhost: https://daniel.haxx.se/blog/2021/05/31/curl-localhost-as-a-local-host/

kesselb avatar May 03 '24 16:05 kesselb

So it doesn't work if you add the entry manually to the hosts file? I've used .localhost domains a few times already and never had any issues, but I also didn't add the hosts entry manually (libnss does it automatically).

provokateurin avatar May 03 '24 16:05 provokateurin

As long as server.localhost resolves to 127.0.0.x everything is all right. It becomes tricky if your .localhost domain should resolve a different IP address (e.g. 192.168.56.1 in my case).

I'm aware it's an edge case and using .localhost by default is nevertheless a good idea, but I would love to see a brief hint in the readme if we flip to .localhost about this limitation.

kesselb avatar May 03 '24 16:05 kesselb

More complex setup's should go with .internal as per https://www.icann.org/en/public-comment/proceeding/proposed-top-level-domain-string-for-private-use-24-01-2024

kesselb avatar May 03 '24 18:05 kesselb