What is traefik.me?
Just like nip.io or xip.io, traefik.me is a magic domain name that provides
wildcard DNS for any IP address. Say your LAN IP address is 10.0.0.1.
10.0.0.1.traefik.me resolves to 10.0.0.1
www.10.0.0.1.traefik.me resolves to 10.0.0.1
mysite.10.0.0.1.traefik.me resolves to 10.0.0.1
foo.bar.10.0.0.1.traefik.me resolves to 10.0.0.1
...and so on. You can use these domains to access virtual hosts on your
development web server from devices on your local network, like iPads, iPhones,
and other computers. No configuration required!
Alternatively, traefik works with dashes, and provides a default resolving to
127.0.0.1, pretty handy in a local configuration:
10-0-0-1.traefik.me resolves to 10.0.0.1
www-10-0-0-1.traefik.me resolves to 10.0.0.1
mysite.traefik.me resolves to 127.0.0.1
foo.bar.traefik.me resolves to 127.0.0.1
How does it work?
traefik.me runs a custom DNS server on the public Internet.
When your computer looks up a traefik.me domain, the traefik.me DNS server
extracts the IP address from the domain and sends it back in the response.
Thanks to Let's encrypt, a wildcard certificate is available for *.traefik.me.
Just grab the files here:
-rw-r--r-- 1 root root 1850 Aug 16 15:12 cert.pem
-rw-r--r-- 1 root root 3750 Aug 16 15:12 chain.pem
-rw-r--r-- 1 root root 5600 Aug 16 15:12 fullchain.pem
-rw-r--r-- 1 root root 1704 Aug 16 15:12 privkey.pem
As wildcard certificates are only valid for one level depth subdomains, use the
dashed-form subdomain instead of dots. Certificates are regenerated every 60 days.
Ok but why "traefik"?
The name comes from traefik.io, that is an open-source reverse proxy and load
balancer. Used in conjonction with docker, it becomes very handy for local web
development. Here is a typical docker-compose.yml file you might produce:
Launch it with docker-compose up. Open your browser, and visit app1.traefik.me
or app2.traefik.me. It just works as expected out of the box, without additional
configuration or /etc/hosts tuning.
To reach the container from another device on your local network, use the
following docker label :
Say your LAN IP address is 10.0.0.1, visiting http://app126.96.36.199.1.traefik.me
from any device on your local network will reach your app1 docker container.
For Docker Compose + HTTPS usage, checkout this sample docker-compose.yml.
French readers, you might be interrested by the following tutorial from YoanDev.
Kudos to xip.io for the inspiration of the present website, nip.io for the dns
Get in touch with me on twitter.com/@pyrou or github.com/pyrou