ddev: Non-ddev.site hostnames can't work on WSL2, and neither can ddev.site if DNS rebinding disallowed
Describe the bug
When the hostname required for a project is not *.ddev.site, or when DNS rebinding is not allowed, WSL2 browser stuff can’t work.
So:
- If DNS rebinding is disallowed, ddev will add the hostname to /etc/hosts. But unfortunately it’s the /etc/hosts in the WSL2 system, which is not the hosts file that the browser will use (which is C:\Windows\System32\drivers\etc\hosts). So the browser can’t recognize it.
- If project_tld is set to something other than ddev.site, same problem
- If additional_fqdns is set, that has the same problem.
I’m not sure there’s a good solution to this, because WSL2 code can’t change things on the Windows side…
Windows users can work around this issue by manually adding the needed hostnames to C:\Windows\System32\drivers\etc\hosts or by using the windows ddev to issue the command ddev hostname <neededfqdn> 127.0.0.1
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 2
- Comments: 27 (16 by maintainers)
Commits related to this issue
- Allow WSL2 to use ddev on Windows to run ddev hostname, fixes #2533 — committed to rfay/ddev by rfay 4 years ago
- Simplify 'no internet connection' complaints, add to docs, fixes #2578, for #2533, for #2409 — committed to rfay/ddev by rfay 4 years ago
- Simplify 'no internet connection' complaints, add to docs, fixes #2578, for #2533, for #2409 (#2605) — committed to ddev/ddev by rfay 4 years ago
- Allow WSL2 to use ddev on Windows to run ddev hostname, fixes #2533 — committed to gilbertsoft/ddev by rfay 4 years ago
- Allow WSL2 to use ddev on Windows to run ddev hostname, fixes #2533 — committed to gilbertsoft/ddev by rfay 4 years ago
- Allow WSL2 to use ddev on Windows to run ddev hostname, fixes #2533 — committed to gilbertsoft/ddev by rfay 4 years ago
- Touch up Windows WSL2 hosts file support and docs, rename DRUD_INTERACTIVE, fixes #2533 * Rename DRUD_INTERACTIVE to DDEV_INTERACTIVE — committed to rfay/ddev by rfay 3 years ago
- Allow WSL2 to use ddev on Windows to run ddev hostname, fixes #2533 — committed to gilbertsoft/ddev by rfay 4 years ago
This was resolved in DDEV v1.21.4, which now uses Windows-side hosts file management in this situation.
@steffenf14 if DNS rebinding isn’t allowed on your DNS server, you can:
ddev hostname
on the Windows side. Unfortunately, a hostname has to be added for each project/hostname.