
Ask HN: What TLD do you use for local development? - Sevrene
I&#x27;ve heard all sorts of reasons against using .local, .dev or .app. Is there a definitive standard for this?<p>What TLD do you use for local development? or do you just forgo the domain all together and use your local IP?
======
guessmyname
I use ".test" to respect RFC-6761 [1] which reserves four TLDs: .example,
.invalid, .localhost, and .test; as many of us already know ".dev" is owned by
Google [2] and both ".local" [3] and ".app" [4] are reserved for the root zone
so it doesn't makes any sense to use any of them for local development. So I
use ".test" for my personal projects and ".[company]" for projects related
with my job.

[1] [https://tools.ietf.org/html/rfc6761](https://tools.ietf.org/html/rfc6761)

[2] [https://icannwiki.com/.dev](https://icannwiki.com/.dev)

[3] [https://tools.ietf.org/html/rfc6762](https://tools.ietf.org/html/rfc6762)

[4] [https://icannwiki.com/.app](https://icannwiki.com/.app)

~~~
kijeda
.local is reserved, but not for delegation in the root zone. RFC 6762 reserves
it for Multicast DNS on a local network.

------
ryanlm
I use a subdomain of a domain I own, such as internal.example.com

I can then run a BIND instance with internal.example.com as a root, then map
all my services to their own domain if need be.

This is a little overkill for a one man shop, but it's a nice little home
development setup.

The one thing you need to configure, if you want it to work out of the box is
that your DHCP server needs to send back the IP address of your local BIND
service for DNS, else it won't work right and you'll need to manually
configure it every time.

An example of where this worked well for me was when I was using one nginx
instance to run snapshots of all my clients websites. With nginx, you can set
up "virtual hosts" which map a hostname to a configuration block. You could
also just edit your /etc/hosts file to accomplish the same thing I guess.

~~~
btgeekboy
I do something similar. My home network's recursive DNS server is a local
install of Unbound. Setting local overrides there is very easy, though I don't
use it in a hierarchical format. (Unbound refers to these as local-data.)

------
tdy721
I use .dev of course! I realize that .test is the sensible choice, but there's
some odd WordPress/Serialization benefit to keeping the TLD length the same.

Google bought it up, and I've never seen it in the wild, so it works well for
me.

~~~
kylehotchkiss
Ha I actually know what you mean, php serialized data having string length as
a parameter always confused me

------
giancarlostoro
I edit my host file and use .dev for specific domains, if you configure a web
server to said domains it'll route you to the right folder as well (edit:
Virtual Host). Though I typically use Vagrant or VirtualBox to test my
environments off a 'remote' server.

------
SimeVidas
Are there any issues with just using something like `localhost:3000`?

~~~
pwim
1) Subdomains. If you're app utilises subdomains, you need to use a TLD.

2) Integration with development tools like [http://pow.cx/](http://pow.cx/) or
[https://github.com/puma/puma-dev](https://github.com/puma/puma-dev) allow you
to automatically startup and shutdown apps. This is useful when you're
juggling multiple apps.

3) Security. Using a standard domain/port for local development opens you up
to exploits like [http://benmmurphy.github.io/blog/2016/07/11/rails-
webconsole...](http://benmmurphy.github.io/blog/2016/07/11/rails-webconsole-
dns-rebinding/)

------
bigiain
I remember a tile back in early the 2000s when we had a quite nice setup of
local dns servers that had internal only zonefiles that resolved names like
service.company.local to the internal/dev versions of service.company.com.

Worked quite nicely until the Mac users upgraded to a version of OS X which
included Bonjour...

There days Mac OS X does a pretty nice job here all on it's own - this machine
I'm typing on here happily answers as Iain.local to the internal network...
(For some not-worth-my-time-to-debug reason, our Netgear NAS is a whole lot
less reliable with it's Bonjour/zeroconf .local name...)

~~~
Sevrene
Yeah I heard that bonjour messed up .local, although isn't that meant to be
reserved for actual local nets or something?

~~~
adambrenecki
It's reserved for multicast DNS, which is what Bonjour uses.

------
dmlittle
You can modify your /etc/hosts to point to localhost and that does the trick
without having to go through a TLD or care if the domain is taken.

Contents of /etc/hosts:

127.0.0.1 domain.com

127.0.0.1 subdomain1.domain.com

127.0.0.1 subdomain2.domain.com

~~~
asadjb
I run a local dnsmasq server, and just have the resolver for the 'dev' TLD
point to that. This way, _any_ .dev URL always points to my local machine. I
just configure it in Nginx and I'm good to go.

~~~
dmlittle
Running a local DNS resolver for local development seems like an overkill. You
have to have the resolver and nginx properly setup and constantly running (not
that it's a issue)

~~~
bitJericho
My old router, ddwrt, has this out of the box. My new router, pfsense, has
override settings, tho not sure through what daemon that is configured
through. I also run a windows domain with DNS. There are many ways to do it.

------
laurencei
I personally use ".vm"

I run a vagrant box on my Windows machine - so ".vm" describes what I do very
well.

And unless a new country is formed, there will never be new 2 letter TLDs.

~~~
Symbiote
There are new country code domains occasionally.

The last was in 2010, adding BQ.

------
nstart
I use a subdomain and run it in the form of dev.<myactualdomain>.com . I add a
record to my /etc/hosts file to redirect it to 127.0.0.1. This also means for
https stuff I have a valid certificate to use as well. One more note. I almost
never run anything on any port other than port 80/443\. Any application I work
on generally has nginx sitting in front of it with a simple proxy_pass rule.

------
voycey
I still use .dev for the majority of sites, I'm pretty pissed that Google was
allowed to appropriate it! It has so far bitten me on the ass once when a CDN
was involved (the CDN resolved it to Googles servers so the failure wasn't
detected - causing numerous invisible problems).

I think I will probably go along the route of assigning a domain to my local
network

------
thrillgore
I have historically used .local despite its use with the Multicast DNS
Standard. I have not encountered any technical issues with its use.

If my devices were on a network accessible from the outside world, I would
have used my ghostfreeman.net domain and submasked all of those projects.
However, these resources can't leave the network.

------
fiddlerwoaroof
I just use a subdomain of a domain I own

~~~
Sevrene
Do you actually set the A record for it, or do you just set it up in
/etc/hosts? Seems risky if it's the first.

~~~
bitJericho
Why risky?

~~~
majewsky
You're needlessly exposing private information about your system to the
public, which an attacker can use to learn about the structure of your setup,
or to appear more credible during a social engineering attack.

And if the IP of the development system happens to be publicly routed,
attackers might reach and infiltrate a probably insecure development system.

~~~
bitJericho
Ah yes I would agree. However, you're best off using a local dns server to
route to a private subdomain. It is handy to use a public facing IP to also
point towards your service though, if, and only if, you want it web
accessible.

------
claydiffrient
I use .docker because I use dinghy for all my development
([https://github.com/codekitchen/dinghy#dns](https://github.com/codekitchen/dinghy#dns))

------
throwaway2016a
Since no one has mentioned this one yet, I use '.loc' throught /etc/hosts

Each dev on the team use the same .loc domains but the IP may be different
depending on the IP the Docker interface is assigned.

------
healthnutter
One trick is to use non-routable (e.g. 192.168.0.0/16) IP addresses with DNS
records for subdomains of your company's domain name, e.g.
devserver123.mycompany.com routes to 192.168.100.123

~~~
bitJericho
This gives insight to your internal network structure to the public. It's
better to run a local DNS server for internal use.

------
na85
I use .lan

------
kalleboo
local.<domain of site i'm working on> set in my hosts file

Or just "localhost" if it's a personal project with no domain

------
chrisabrams
.bingo has been great.

------
smt88
It doesn't matter. Use anything fake/non-public.

~~~
Viper007Bond
On the contrary, it does matter. What if you used [random].com and someone
registered it? Presumably you'd use a different TLD and the chances are slim,
but it's still best to use a correct test URL.

~~~
smt88
The chances would not be slim. They'd be zero, because you'd be using a fake
TLD.

~~~
Viper007Bond
.dev used to be a fake TLD, as did .local. Both now exist.

Don't assume what doesn't exist now won't exist in the future. ;)

------
beilabs
I use whatever domain I like + .lvh.me -> 127.0.0.1

------
bdcravens
lvh.me for non-public addresses where I want to test subdomains

ngrok.io when it needs to be public

(yeah, I know those aren't TLDs, but I rarely use any when developing TBH)

~~~
majewsky
> lvh.me

This looks interesting, but how would one ever find out about this?

~~~
bdcravens
Good question. I can't remember where I heard about it, as I've been using it
for 3 or 4 years ... Hartl's Rails tutorial perhaps?

------
avitzurel
local.<mydomain> set it in my hosts file.

------
reustle
I use dev.projectname.com

------
jay_kyburz
192.168.1.2 FTW!

~~~
urda
IP address are NOT TLD's.

~~~
myhf
A digit is allowed to be a TLD, and is easy to type[1]. UIs will probably
treat an all-numeric address as an IP though.

[1] [https://cr.yp.to/djbdns/dot-local.html](https://cr.yp.to/djbdns/dot-
local.html)

------
crisopolis
lvh.me

