Using MIAB for Shopify - subdomain custom DNS not working

Hi! I have a MIAB machine that is working great, and is up to date. One of the domains hosted on it is a shopify store, that I’ll call mystore.com. I followed Shopify’s steps to set that up, so I don’t want to change any of those records. I’m trying to add some additional functionality to my store, using a custom API I wrote, so I’m trying to add api.mystore.com. I added this in custom DNS, but it’s been several days, and it still won’t work. When I try to access it, Chrome says api.mystore.com ’s server IP address could not be found.

Here’s a screenshot of my DNS setup, that I modified in Chrome to hide IPs and such:

image

Things seemingly look ok. No way to say anything more without the ability to test DNS with various tools … which cannot be done not knowing your domain name.

What does nslookup say about api.mystore.com, and can you dig it @ the box’s name server?

@timothy, @alento is right without more details it’s hard to get to the bottom of the issue.

If your old records are working correctly and the only api.. is not resolving the issue may be with upstream secondary NS not being updated by MIAB nsd, or could be the nsd itself or bind(named) - check the log files for clues:

grep -ir nsd /var/log/
grep -ir named /var/log/

you can restart the services nsd and bind9, and see if there are any errors in the logs?

You can run a few tests on the MIAB itself:

dig @127.0.0.1 api.mystore.com +short
dig @secondary_upstreem_NS api.mystore.com +short
dig @your_domain_registratr_NS api.mystore.com +short
dig @8.8.8.8 api.mystore.com +short

All these should successfully resolve to your server IP. If they do then run another one on your PC ( assuming windows OS ) in cmd or PowerShell:

nslookup api.mystore.com 
nslookup api.mystore.com 8.8.8.8

Judging by the results you may draw a further conclusion where the issue might be?

Regards,

nslookup on my local pc says “ubnt can’t find api.mystore.com: Non-existent domain”

nslookup on my miab server says “server can’t find api.mystore.com: NXDOMAIN”

checking nsd shows this error: “error: mystore.com.txt.signed:8: CNAME and other data at the same name” but doesn’t say anything about the api subdomain.

dig @127.0.0.1 api.mystore.com +short
Returned nothing
dig @secondary_upstreem_NS api.mystore.com +short
Returned my mail server’s IP address
dig @your_domain_registratr_NS api.mystore.com +short
My domain is registered through google, so I think this is the same as the 8.8.8.8 below, right?
dig @8.8.8.8 api.mystore.com +short
Returned nothing

After first encountering this problem, I updated MIAB and all packages before asking here, just in case. I see now that v0.4.0 is available, but I assume that’s only for Ubuntu 18.04, which I’m still planning my future upgrade to. I’m running v0.3.0. That included I think 2 reboots, so all the services should have been restarted with that.

Ok, your issue mimics an issue I was working on the other day. Can you please take a look at your admin area custom DNS page and note any custom entries specifically the CNAME entries.

I added another DNS record of api2.mystore.com and that didn’t work either, so I added ANOTHER one on another domain of mine, and that did work. So, the box DNS seems to be working. Would the CNAME pointed at the domain impact anything? That’s the only thing (that I can think of) different about it and my other domains…

I have 10 domains on the MIAB server and 22 custom DNS entries. I only have the 2 CNAMES and they’re both for this domain.

Delete them both. We will look at reinstating them later. Later, as in a few minutes.

Later as in in a few minutes, after I do some more stuff you tell me, or later as in with a new version of MIAB? I’m worried about downtime with my store. It doesn’t do massive sales but gets ~250 visitors/day.

Later, as in a few minutes.

After you have removed them - if successful, do another nslookup for the api. subdomain.

If unable to remove them, what is the error message?

Just a note to you and to others — it is infinitely more simple to try to troubleshoot for people if your domain name is disclosed. I understand the desire for privacy in this type of a forum, but sometimes it makes things so much simpler to trust someone else.

Deleted them both and now the API subdomain works…

Flush your DNS on your local machine, then attempt to access your store. What is the result?

Store works fine! Is that CNAME not really required? Or is this not the expected behavior?

I believe that the CNAME is not required. To be honest I overlooked it because of your editing of the domain name.

After reviewing the Shopify Help Center it seems that the problem was the fact that you had BOTH CNAME and A records for the root domain and the www. subdomain. You need an A record for the root domain and a CNAME record for the www domain ONLY. Personally, I prefer to just use an A record as using a CNAME record requires an additional DNS lookup. The benefit of using a CNAME record is if the IP address changes only one record needs to be changed rather than potentially several.

It’s a shared IP address.

I found the article here: https://help.shopify.com/en/manual/domains/add-a-domain/using-existing-domains/connecting-domains it doesn’t really say why, it just says to do it.

But looking at it, mine wasn’t setup right anyways, unless that article changed after I set mine up. I had shop.myshopify.com and not shops.myshopify.com. Not that it necessarily mattered. Anyways, I’ll consider this one resolved. Thanks for your help!

Next time I have an issue, I’ll drop all the mystore secrecy stuff and just my real domain. Sorry if that caused any inconvenience with this issue.

Thanks again!

Yeah, it does make it simpler usually - but to be honest in this case the clue that solved the puzzle was this: