3

Been trying to this for a few days after countless tutorials and I can’t seem to figure it out.

The desired outcome is this:

www.example.com is my main react app hosted on Google Cloud Servers.

blog.example.com is my Gatsby blog hosted on Netlify.

More Detail:

I have a robust react app that is hosted on www.example.com, on a Google cloud server. The domain is registered with Google domains.

I want to add a new subdomain, blog.example.com and have it point to Netlify, where I host a simple Gatsby blog.

Everything I find always leads me to change my apex/main domain to netlify servers, but this is not the desired outcome as it will no longer point to my main app, and the email accounts associated with it stop working as well.

I have no idea how to do it.

From my understanding, we can add an A record on Google domains:

blog.example.com A 1.2.3.4

or add a CNAME:

blog CNAME → theNetlify-app-name.netlify.app

Neither of these solutions seem to work.

Any suggestions?

3
  • Your theory is correct. Im not sure we can help you find what is not working unless you provide the actusl domain (ideally with the a or cname record set up.) It coukd be you are acting on the wrong servers, or conceivably a caching issue.
    – davidgo
    Commented Feb 1, 2021 at 18:30
  • So upon changing those DNS settings for the subdomain, it now leads to a 404. On netlify's end, I added a domain (blog.mysite.com) and it is telling my DNS nameservers are not configured, and to add them to my domain provider, which ultimately will accomplish something I do not want. I'd share the actual domain but currently, it is undergoing a pilot test so it's private.
    – Robolisk
    Commented Feb 1, 2021 at 18:35
  • 3
    Have you configured your Netlify blog with the subdomain host domain that you are pointing at it? A 404 error usually indicates that the DNS is pointing to the server but that the server doesn't know which blog to show when it gets requests for that name. Netlify has documentation for custom domains including how to configure subdomains through external DNS. Commented Feb 1, 2021 at 18:47

1 Answer 1

2

You can use a CName to map your desired sub domain to your Netlify site as per their documentation:

Mapping an existing sub-domain

The important thing is that both ends (Google Domains and Netlify) need to know about the new domain.

In summary you need to configure your external DNS provider to point your domain to Netlify:

On your Netlify control panel, select the "Custom domains" panel, select "Check DNS configuration" next to the custom domain to open customized details about the DNS records you need to configure.

To point a subdomain such as blog.petsofnetlify.com to your site on Netlify, you must first create a CNAME record with your DNS provider.

For example, if your site’s domain is blog.petsofnetlify.com and your Netlify subdomain is brave-curie-671954.netlify.app:

  • Find your DNS provider’s DNS record settings for your apex domain, petsofnetlify.com.
  • Add a CNAME record with your subdomain, blog, as the host.
  • Point the record to your Netlify subdomain, brave-curie-671954.netlify.app.
  • Save your settings. It may take a full day for the settings to propagate across the global Domain Name System.

Once you've completed those steps with Google Domains, you then need to complete the steps in the Netlify control panel to assign the custom domain to your site:

Select "Add custom domain" at the bottom of the "Custom domains" panel, and enter your domain name. Select "Verify".

Pressing verify will check that the DNS settings you've entered in Google Domains are correctly configured and pointing at the Netlify site - if they are, then your new domain should be configured and serving pages as expected.

Your Answer

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

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