How to make nginx to resolve DNS names to the host machine?


We are already using fairly simple Docker in development environment just to manage service dependencies but the current task seems to be much more complicated.

In order to introduce multitenancy into our app, we would like to have a dynamic 3rd level domain name resolution with request dynamically proxied to the host machine.

Here is what I’m thinking about

Point domains to the Docker VM in the host’s /etc/hosts file : (using DLite here)

Add dnsmasq which will resolve those domain to the host IP:

Make NGINX to resolve hosts via linked dnsmasq container:
server { listen 80; server_name; resolver; }

Is it a correct (idiomatic) way to do that kind of thing?

1 Like

Hmmm good question. :hourglass_flowing_sand:

Try: resolver valid=10s;