You will need about one minute to read this article.
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.
This service is very straight forward. Any request to a subdomain of
lvh.me will resolve to
$ nslookup myapp.lvh.me Server: 10.0.3.1 Address: 10.0.3.1#53 Non-authoritative answer: Name: myapp.lvh.me Address: 127.0.0.1
If you need more flexibility with regards to the resolved IP address try xip.io.
You can configure the IP address as part of the domain name. A name like
myapp.127.0.0.1.xip.io will resolve to
$ nslookup myapp.127.0.0.1.xip.io Server: 10.0.3.1 Address: 10.0.3.1#53 Non-authoritative answer: Name: myapp.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.
As an alternative to xip.io there is nip.io. It works the same way.
$ nslookup myapp.127.0.0.1.nip.io Server: 10.0.3.1 Address: 10.0.3.1#53 Non-authoritative answer: Name: myapp.127.0.0.1.nip.io Address: 127.0.0.1
Do you think we need to improve this article? If so, please submit our feedback form to help us improve this article!