2

I own a domain on Google Domains.

I want to create subdomains for my projects dynamically.

For example:

My Domain:
https://adomain.example

Subdomain:
https://project-name.adomain.example

Where the subdomain redirects you to:
https://project-name.example

So when a user navigates to https://project-name.adomain.example - they will be redirected to a completely different website, hosted elsewhere (https://project-name.example).

I know I can achieve this by creating a Synthetic Record via the Google Domains DNS menu: screenshot of the Google domains synthetic record DNS menu

But I have to manually navigate to the Google Domains dashboard and input my values there.

I was able to find the following question which shows that you can pass credentials via a URL: https://stackoverflow.com/questions/51544160/how-can-you-change-the-ttl-value-of-a-google-domain-synthetic-record

I'm not confident about passing my username & password in plain text via a URL to create a synthetic record.

Is there any other way of achieving this? Any resources I can have a look at? An API of some sort?

1 Answer 1

1

You would typically implement this functionality using wildcard subdomains. Rather than point each subdomain at your server individually, you would point all subdomains ato your server and let your web application determine how to handle them.

From a DNS perspective, that would be implementing a record like:

*.adomain.example CNAME adomain.example

or

*.adomain.example A x.x.x.x

Where x.x.x.x is the IP address of your server.

Then on your webserver you would set up a wildcard virtual host. See on Stack Overflow: Virtualhost For Wildcard Subdomain and Static Subdomain. The web app software on that virtual host would examine the requested subdomain and either isssue the required redirect, or return a "404 Not Found" error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.