Answers: <p>People often use dnsmasq for this.  You can wildcard sub-domains like this fairly easily for local testing using it.</p>
  
  <p>Here's an example - <a href="https://qiita.com/bmj0114/items/9c24d863bcab1a634503" rel="nofollow noreferrer">https://qiita.com/bmj0114/items/9c24d863bcab1a634503</a> but there are plenty online.</p>
  
Answers: CC BY-SA 4.0
Answers: 2020-04-22T11:39:56.873Z
Answers: 2020-04-22T11:39:56.873Z
Answers: John Humphreys
Body: <p>An app, running on my laptop in development mode, comprises several Docker containers, one of which runs a Django web app.</p>
  
  <p>This web app expects to receive HTTP requests using a hostname with a variable leading part, e.g. "test-account.survey.com", in which 'test-account' is a slug representing a particular account, and the remaining string 'survey.com' is fixed.</p>
  
  <p>Now I know this can be resolved in a Live environment, involving external HTTP requests, by using wildcard DNS servers [ <a href="https://en.wikipedia.org/wiki/Wildcard_DNS_record" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Wildcard_DNS_record</a> ].</p>
  
  <p>But I'd like to set up and configure on my laptop a local DNS server for the sole purpose of forwarding hostnames as above to a fixed IP address, e.g. 127.0.0.1 and "passing through" any other hostnames.</p>
  
  <p>Any recommendations? Thanks in anticipation.</p>
  
  <p>P.S. The DNS server must support Windows 10 and Mac OS.</p>
  
Tags: <docker><dns>
Title: How to locally resolve host name starting with variable slug?
UserDisplayName: John Ramsden
ThreadText: # How to locally resolve host name starting with variable slug?
  
  (Asked by: username_0 on 2020-04-21)
  
  An app, running on my laptop in development mode, comprises several Docker containers, one of which runs a Django web app.
  
  This web app expects to receive HTTP requests using a hostname with a variable leading part, e.g. "test-account.survey.com", in which 'test-account' is a slug representing a particular account, and the remaining string 'survey.com' is fixed.
  
  Now I know this can be resolved in a Live environment, involving external HTTP requests, by using wildcard DNS servers [ <https://en.wikipedia.org/wiki/Wildcard_DNS_record> ].
  
  But I'd like to set up and configure on my laptop a local DNS server for the sole purpose of forwarding hostnames as above to a fixed IP address, e.g. 127.0.0.1 and "passing through" any other hostnames.
  
  Any recommendations? Thanks in anticipation.
  
  P.S. The DNS server must support Windows 10 and Mac OS.
  
  **Tags:** docker, dns
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-04-22. Score: 1
  
  People often use dnsmasq for this. You can wildcard sub-domains like this fairly easily for local testing using it.
  
  Here's an example - <https://qiita.com/bmj0114/items/9c24d863bcab1a634503> but there are plenty online.
  
  
  ---
  
  