How to add subdomain to Heroku app if I use Netlify DNS for my Apex domain?

Hello,

I have bought a domain name with OVH. The frontend is hosted on Netlify and use your DNS. Basically, I’ve deleted the two DNS servers provided by OVH and replaced them by your 4 DNS servers:

The website is working, with a correct TLS certificate. So far so good.

The website is communicating with a server hosted on Heroku. It works fine. However, I need to use a subdomain instead of heroku’s default url in order to be able to send cookies to Safari browsers (sameOrigin: none is not accepted by this browser).

Basically: www.hello.heroku.app should be www.server.hello.app.

Ok. So I’ve added a CNAME entry to my DNS ZONE with OVH, that points to Heroku’s DNS target. Unfortunately, this CNAME is never propagated. In my DNS ZONE, I have this warning:

It seems OVH DNS ZONE’s entries can’t exist without using their default DNS entries. How can I fix this? Should I delete the DNS records in Netlify and use a different strategy?

Please note I’m a complete noob with devops. I’ve asked the question to OVH support. They answered “Netlify handles your DNS. You must modify the zone with them”.

The way this usually works is the following:

You change your nameservers to the ones given by Netlify (your case):

In this case, all your DNS is managed by Netlify. Now, any changes that you need to make, like add subdomain, MX records, TXT records for verification, etc., you need to add those in your Netlify DNS management in the UI.


You connect your domain to Netlify using A + CNAME records:

This is an alternative way many people use to connect their domain to Netlify. In this case, the DNS is managed either by the original domain registrar, or a third-party DNS tool (depends on the nameserver configuration of the domain). So, all the editing of DNS records including addition or subtraction of records happens in the registrar or the third-party tool.

So to conclude, what OVH support has said is completely true. Your DNS is now managed by Netlify. So, the subdomain that you need to point to Heroku should be added in your Netlify UI. You can edit the records here: https://app.netlify.com/teams/<team-name>/dns/domain.tld.

Hope this helps. In case of any further questions, let us know.

Hi Hrishikesh,

Thanks for your answer! So, in order to keep things simple and start fresh again, I’ve simply removed the domains from Netlify’s domain settings, and reseted the OVH DNS server to their default settings.

There is now only the basic address hello.netlify.app (this is an exemple url). So, on OVH I’ve pointed Netlify’s IP on the Apex domain hello.app.. (highlighted in red in the screenshot below):

Should I point the second A entry www.hello.app to hello.netlify.app, www.hello.netlify.app, etc? Will the website benefit from an automatic tls certificate thanks to Netlify? Should I make anything special with Netlify afterwards? Frankly, I’m completely lost.

The second highlighted entry is the CNAME server.hello.app, which points to the Heroku server.

Another detail: after the reset, I have this warning on my OVH DNS Zone panel:

It’s so weird, because I already use dns200.anycast.me and ns200.anycast.me. Should I delete dns11.ovh.net and ns11.ovh.net from my DNS server panel? It seems that the DNS Zone won’t be propagated otherwise…

According to the docs: Configure external DNS for a custom domain | Netlify Docs, all you need is the A record with the IP address. So that seems good. However, as the docs mention, this method can’t take advantage of direct DNS routing on Netlify’s global CDN. So use it only when you absolutely can’t change the nameservers.

Other than that, the only thing you need to do is actually attach the domain to a Netlify website, which I guess you’ve already done. So no more configuration needed.

The error in OVH shows that you’ve still set Netlify nameservers in your OVH settings. Thus, any changes that you make to OVH currently are not having any effect. If you’ve indeed changed the nameservers back to your OVH ones, then it might be DNS propagation time as it sometimes needs about or over 24 hours.

Sorry, I’ve uploaded the wrong screenshot. The OVH error actually doesn’t show Netlify’s DNS. Please see the updated screenshot in my previous post.

Yes, I’ve got a Netlify app with a name like hello.netlify.app. Is that enough? Don’t I need to point the A record www.hello.app to www.hello.netlify.app (or similar address)?

I’d actually prefer to use Netlify CDN, it’s easier to manage. The only thing is that I can’t create a proper subdomain https://www.server.hello.app that points to a Heroku DNS target from Netlify. If you can show me how to add this from Netlify, I’ll use your technique.

Safari’s sameSite cookie policy is the only reason for which I’m into all these troubles^^.

If you connect the domain to Netlify using nameservers, you need to add the same CNAME records for the Heroku app that you added in your OVH screenshot above.

In Netlify DNS panel here: https://app.netlify.com/teams/<team-name>/dns/domain.tld, go to add new record:

Choose record type as CNAME:

Add the details:

The name should be what you want your subdomain to be. For example, if you want server.foo.com, you only need to type server. The value should be your Heroku address.

Hope this helps.

Ok, thanks! Two last questions though:

  1. I have eventually managed to add the server.hello.app CNAME in OVH. So maybe I could finish the whole process with the external DNS. The A record hello.app is pointing to your IP 75.2.60.5, and there is also a CNAME www.hello.app pointing to hello.netlify.app. I’ve check the propagation, it seems everything is complete. Yet, I can’t access the website https://www.hello.app .

Based on this youtube tutorial I clicked on “add custom domain” so I could enable automatic TLS certificate too. But it automatically configure the domain with Netlify DNS. I never have the choice to keep my external DNS when doing so. All my apologies if this is explained in the docs, I havn’t seen it.

  1. If I use OVH DNS, does the app benefit from Netlify CDN?

Is hello.app a placeholder domain? If yes, what’s the real domain that’s being discussed? It could help us find out what’s happening with it.

The Netlify DNS badge that you see in Netlify dashboard is just an indication that your DNS is configured correctly and Netlify should be serving the domain. It doesn’t necessarily mean you’re using Netlify to manage your DNS.

About the question, no. As the docs mention (linked above), if you use external DNS, your website won’t be able to benefit from the global CDN since it will always point at one single IP address.

Thank you so much for your time and your help! The issue is now fixed. Seeing the “Netlify DNS” badge next to the custom domain name mislead me. I would suggest to write “external DNS” instead in such case.

1 Like