Friday 11 November 2011

Easy DNS mistake with TXT and wildcard records

I recently discovered that it's actually quite easy to get your DNs settings wrong and potentially take your site offline. Especially if you've got a lot of domains and subdomains. This issue is specifically to do with having a wildcard set up for your domain and also having TXT records for subdomains.
I thought I'd better share this to stop any one else making the same mistakes I have.

The Problem
So for example if you bought the domain xyz.com (you'd be very lucky, that domain is no doubt be worth a fair bit of money) and you set it up to have an '@' A record and a 'www' CNAME or A record.
And while your there why not configure '*' (a catch all) and you configure them to point to your site.
That way your site will respond to xyz.com, www.xyz.com, ww.xyz.com, wwww.xyz.com, abc.xyz.com, etc, etc.
Then maybe  you'll configure your server to redirect everything to www.xyz.com.

Now let's say you add a forum to your site using forum.xyz.com.
Your domain is already configured correctly so you just set your server to use whatever forum software for that subdomain. All is working nicely.

Now you want to see what Google thinks of you forum, so you stick it into Webmaster Tools.
One of the options to verify your domain in Webmaster Tools is using the TXT record, especially useful if you don't want to have to change any code or upload any files.
So you add the TXT record with the value specified by Google.

Now you find your forum has gone offline completely! This is because the way DNS systems work is that you've now created a specific entry for forum.xyz.com with only a TXT record. This means the nameserver will not return any records from the base domain when queried.
Other subdomains (ones without TXT records) will still work as they do not have any records specific to them. So ww.xyz.com and wwww.xyz.com will be fine.

The Solution
The solution is easy just add an A record for any subdomains with their own records, be it TXT or MX.
My registrar said that I could have added a CNAME instead but this didn't work for my. Might just be that particular registrar though.



So your thinking, 'not a big deal as I'd notice it straight away'. And in this example you're probably right.
However, if you have a large or old site. Or a several sites you've combined onto one subdomain. It can be easier to miss. Especially if after a while you move registrars or something.

So that's my small tip for the day. It's worth remembering as no one wants to lose any value from their domains. It's only ever going to hurt.