Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use XXX.localhost instead of XXX.local #171

Open
provokateurin opened this issue Mar 25, 2023 · 5 comments
Open

Use XXX.localhost instead of XXX.local #171

provokateurin opened this issue Mar 25, 2023 · 5 comments

Comments

@provokateurin
Copy link
Contributor

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 provokateurin changed the title Use XXX.localhost instead of XXX.local Use XXX.localhost instead of XXX.local Mar 25, 2023
@juliushaertl
Copy link
Owner

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

@kesselb
Copy link
Contributor

kesselb commented May 3, 2024

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/

@provokateurin
Copy link
Contributor Author

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).

@kesselb
Copy link
Contributor

kesselb commented May 3, 2024

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
Copy link
Contributor

kesselb commented May 3, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants