How to test wildcard subdomains on CircleCI


#1

If you need to test wildcard subdomains in a CI environment there are a few options available to you.

A simple one is to use the free service at http://lvh.me that resolves itself along with all subdomains to localhost. Using this you can set tests to run at something like http://example.lvh.me and you’re done.

Another option is to install and use dnsmasq. You can add an entry like:

# Wildcard DNS entries
address=/.test/127.0.0.1

That would mean dnsmasq will return A records for all domains ending in .test pointing them at localhost:

$ dig +noall +answer example.test
example.test.              0       IN      A       127.0.0.1
 
$dig +noall +answer foo.example.test
foo.example.test.          0       IN      A       127.0.0.1

#2

Very cool, thanks for sharing Tom!


#3

@tom it would be really helpful if you outlined a more-complete “how to install and use dnsmasq”.

When I tried it in an ssh session on circleci, I found that (after sudo apt-get install dnsutils) dig example.test to 127.0.0.1 just fine, however curl -v example.test could not resolve it at all. It felt like the precipice of a rabbit hole so I decided to quit and just use lvh.me for now but for the inevitable day that it quits resolve (as vcap.me did today), I’d like to better understand how to use dnsmasq for a simple use case like this…


#4

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.