How to set up a wildcard subdomain on Google Domains

Today, I was working with dokku, and I found myself in need of a wildcard subdomain. A wildcard DNS record is a record that will match requests for non-existent subdomains. For instance, if you set a wildcard DNS record to *, and a user requests or, etc.. the requests will be forwarded to whichever server * points to.

For my use case, I wanted to host multiple applications on a single server, and wanted to map each app to a subdomain such as,, etc. To achieve this, I needed to set up a wildcard DNS record for *

Currently, I happen to own a domain on Google Domains. Below are the steps I followed to set up the * wildcard DNS record.


I’m using as a dummy domain for demonstration purposes.

Server/VM with a dynamic IP address

For a server with a dynamic IP address, we need to create a dynamic DNS record and a CNAME record in our DNS settings.

Step 1: Create a Dynamic DNS record in Synthetic Records

Create a synthetic record for instead of *

Step 2: Create a CNAME record of the subdomain

Create a CNAME record of the subdomain * and point it to the synthetic records subdomain

Step 3: Set up ddclient on your server

First, make sure ddclient is installed on your server and the ddclient service is up and running.


$ sudo nano /etc/ddclient.conf

And edit these lines using the credentials from the created Google Domains dynamic DNS record:

## Google Domains (
# protocol=googledomains,
# login=my-auto-generated-username,
# password=my-auto-generated-password
# my.domain.tld, otherhost.domain.tld
  • Example:

daemon=3600 # Check every 1 hour
use=web,, web-skip='IP Address'

Verify that the ddclient is working by trying:

sudo ddclient -daemon=0 -debug -verbose -noquiet

Step 4: Verify that our changes have taken effect

We can verify our changes on a UNIX machine by trying one or more of the following commands:

  • host

  • dig

  • nslookup

Once we have a confirmation that our top level subdomain works, we should be able to query any other name under and get back an IP address of our server. Try:

  • host

  • dig +short '*'

Credits: Thank you StackExchange 🙏🏽!

Server/VM with a static IP address

For a server/VM with a static IP address, the process is much simpler. Creating an A record pointing to the IP address of the server/VM suffices: