NetworkManager + dnsmasq = wildcard subdomains for development
I'm developing an application which using multiple subdomains. These subdomains are customizable by the user, so i can't specify them in the my hosts file.
I'm using NetworkManager to handle my connections which can use dnsmasq for caching dns queries, but the instance can be configured easily to do other things: in my case resolving *.app.dev to 127.0.0.1
So, to the point of this post
- add
dns=dnsmasq
line to the[main]
section of/etc/NetworkManager/NetworkManager.conf
- create a file
/etc/NetworkManager/dnsmasq.d/local-development.conf
with the contentaddress=/app.dev/127.0.0.1
- restart the network manager (on my system it can be done with
sudo systemctl restart NetworkManager
)
You can remove the lines from /etc/hosts
you may have used to route to your app )in my case: 127.0.0.1 app.dev sub1.app.dev subx.app.dev
)
I hope it helps you!
Note: If you don't have to work off-line then using *.lvh.me
is much more simpler :)
Written by István Demeter
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Rails
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#