So I have purchased a domain on go daddy by the name let's say example.com. Now I want to direct all *.example.com to a nextjs app hosted on heroku.
I followed the standard process to point any subdomain to a heroku app which was
- Add a custom domain to heroku app by name *.example.com.
- Copy the dns target given by heroku
- Create a cname record in go daddy's DNS records page for the site with * as name and heroku dns target as data.
Now when I try to hit sub.example.com the site is unreachable. The above procedure seems to be invalid for wildcards only. When I repeat the same process for any single subdomain let's say sub.example.com it works perfectly.
I have followed the answer mentioned here. I know wildcards are supported on heroku as mentioned here.
Also FYI the main domain example.com points to another server hosted separately.
This how dns record on go daddy looks like
Type | Name | Data | TTL
------------------------------------------------
CNAME | * | example.herokudns.com. | 1 hour
On heroku side
Domain Name | DNS Target
---------------------------------------
*.example.com | example.herokudns.com