devopsgroup-io / vagrant-hostmanager

:pencil: A Vagrant plugin that manages hosts files within a multi-machine environment.
Mozilla Public License 2.0
1.46k stars 146 forks source link

Windows hosts file allows only up to 8 domain names per IP #188

Closed damijank closed 8 years ago

damijank commented 8 years ago

I have been working on projects which "serve" a count of subdomains from the same codebase. Therefore, I configure my box with aliases for the same domain, sometimes even up to 10 of those. Then, there are always "duplicates" (with and without the leading "www.") so often the hosts file entry ends up with 20+ entries per single line.

This works great on linux systems, but windows does not allow for more than 8 (read below) domain names per IP (per line) in the hosts file. I then edit the hosts file by hand, but every "vagrant up" rewrites the configuration and I have to make corrections time and again.

It would be nice to have the hostmanager detect windows (it does so already, of course) and split-up the configuration into several lines, like this:

## vagrant-hostmanager-start id: 98ed391d-2492-4f6c-aa45-189a0c5ea7e5
172.28.128.3    app.sitename.eu.dev
172.28.128.3    baby.sitename.eu.dev kids.sitename.eu.dev choco.sitename.eu.dev preview.sitename.eu.dev sitename.eu.dev
172.28.128.3    www.baby.sitename.eu.dev www.kids.sitename.eu.dev www.choco.sitename.eu.dev www.preview.sitename.eu.dev www.sitename.eu.dev
## vagrant-hostmanager-end

I figured this out by trial and error (the limit of 8, that is) and it could actually depend on the windows version. I'm on Win8.1.

Thank you and Best Regards, Damijan

seth-reeser commented 8 years ago

Please update to the latest vagrant-hostmanager, this has been resolved.

damijank commented 8 years ago

I'm sorry to tell you but the update to 1.8.1 hasn't fixed the issue. The entries in the hosts file are still a "one-liner" with many domain names.

Although, now I found out that it's not (sort of) windows' fault alone, but somehow the following does not happen on linux:

IIRC: browsers try to be "smart" and do not let me use ".dev" on sites which are otherwise live and up-and-running. I have no clue why, in contrast, it miraculously works when I edit the hosts file as described :( I could actually open one (and only one) of the subdomains even before I made the edit - probably the browser did not recognize it as an existing live domain.

Well, strange things happen here... :)