Custom DNS Resolution

Sometimes you need to access your application at a specific URL during the build.

As it is not possible to modify the /etc/hosts file or run your own DNS server on the build VMs, we recommend you use a wildcard DNS service instead.

There are a couple different services available for you to use, the two we would recommend are lvh.me and xip.io.

lvh.me

This service is very straight forward. Any request to a subdomain of lvh.me will resolve to 127.0.0.1.

$ nslookup database.lvh.me
Server:		8.8.8.8
Address:	8.8.8.8#53

Non-authoritative answer:
Name:	database.lvh.me
Address: 127.0.0.1

xip.io

If you need more flexility with regards to the resolved IP address we recommend xip.io.

You can configure the IP address as part of the domain name. A name like www.127.0.1.1.xip.io will resolve to the 127.0.1.1 IP address.

$ nslookup database.127.0.0.1.xip.io
Server:		8.8.8.8
Address:	8.8.8.8#53

Non-authoritative answer:
Name:	database.127.0.0.1.xip.io
Address: 127.0.0.1

In most cases this additional flexibility is not required, as you can’t modify the IPs of the build VMs. You can however make use of this with other loopback ip addresses.

Need More Help?

Get in touch if you need more help, or post on Stack Overflow using the tag #Codeship.