Relying on a magical domain "just for development" is extremely careless behavior. Even assuming that these addresses always resolved to 127.0.0.1 with no interruption, slowdown, or redirection ever, do you really want to be leaking private hostnames etc. over the internet? Simply run a local DNS with forwarding, create a zone or two for your internal machines, all done. And you can even have other record types besides A and PTR...
See also: <a href="http://xip.io/" rel="nofollow">http://xip.io/</a><p>> xip.io is a magic domain name that provides wildcard DNS
for any IP address<p>So you can test stuff on your phone/tablet without messing with 'hosts' file, for instance: myapp.192.168.0.1.xip.io will resolve to 192.168.0.1.
I'll recommend using dnsmasq plus some local resolver configuration to set up your own host-local magic domain, eliminating the need for reliance on a third-party magic domain.<p>Pow[1] by the Basecamp folks provides a nicely packaged version of dnsmasq tooling for Rack & Rails apps. See also, the guard-pow and powder gems which make using Pow even nicer.<p>For other cases (and the DIYers among us) Thomas Sutton wrote up instructions for setting up dnsmasq[2] on OS X for app development. IIRC, the dnsmasq setup should be identical on other *nix flavors. Your local resolver configuration may vary, but this guide will get you pointed the right direction. I highly recommend reading [2] even just as a guide to understand/demystify what Pow does under the hood.<p>The dnsmasq setup can also be used for tools like Dokku[3], a Heroku-style service you can run in (e.g.) a local VM.<p>[1] <a href="http://pow.cx/" rel="nofollow">http://pow.cx/</a><p>[2] <a href="http://passingcuriosity.com/2013/dnsmasq-dev-osx/" rel="nofollow">http://passingcuriosity.com/2013/dnsmasq-dev-osx/</a><p>[3] <a href="https://github.com/progrium/dokku" rel="nofollow">https://github.com/progrium/dokku</a>
If you use Vagrant for development, there are some plugins that will modify your HOSTS file automatically when you start your Vagrant VM. See for instance <a href="https://github.com/cogitatio/vagrant-hostsupdater" rel="nofollow">https://github.com/cogitatio/vagrant-hostsupdater</a>
It resolves at least to that for now. Until someone forgets to pay the bill (for various reasons), runs out of money in their bank account to keep it up or whatever reason there might be.<p>Then devs around the globe scramble to find out what data might have been leaked and to whom.
Or, if you have your own domain, set up a wildcard in your DNS, which could be external (I use cloudflare - free and reliable).<p>Example:<p>I own rikk.us and want to be able to set up many websites on a few machines with my network, so:<p>I point ✱.l.rikk.us to my laptop and now I can set up as many websites as I like on my laptop, so long as they have a binding matching ✱.l.rikk.us, and have them all work just as if they were on separate hosts.<p>This allows me to make testsite1.l.rikk.us, testsite2.l.rikk.us, oh.bugger.i.broke.it.l.rikkus.us, etc.<p>✱ Sorry for the heavy asterisks but I don't know how to write a normal one without it triggering <em>
This looks like another .lvh.me Although it's nice to have a backup.<p>I've found this invaluable when testing subdomains. Each of our accounts gets their own subdomain and testing that is a huge pain with a hosts file (need to explicitly map each one).<p>The wildcard nature of .til.io or .lvh.me is key.<p>The only issue I've noticed with 192.168.1.101.xip.io is that if your server code splits domains on dots and expects things to be in the "nth" place then things can go wrong (cough cough Rails).<p>The other thing this is super useful for is testing subdomains locally from a mobile device.
OT, but someone should start the .JS TLD for the tons of useful javascript libs out there. How awesome would it be to just go to Angular.js or node.js and have that be their actual site?
We have something very similar at our workplace. *.l.tsl.io resolves to localhost. We usually use it to test hostnames[1] on our django projects on the the local developeent server. Definitely beats having to add a lot of records to /etc/hosts.<p>[1]: <a href="http://django-hosts.readthedocs.org/en/latest/" rel="nofollow">http://django-hosts.readthedocs.org/en/latest/</a>
I usually just use the real sitename with a .vm tld if I'm working in local dev space.<p>If it turns out that someone starts up a .vm tld for real, well, no loss. I'll just switch to something else.<p>There's no right and no wrong way to do this on your local machine as long as you don't break the internet for everyone else and as long as it's repeatable/undoable.
I have used this for a while and it works fine. I understand that it is not for every project, but you can set up quickly an app.<p><a href="https://ngrok.com/" rel="nofollow">https://ngrok.com/</a>
I got tired of editing my host file for local development. Have been meaning to do this for a while, but I never had a domain name short enough so as not to be annoying to type.