Forum Moderators: phranque
I've always used A Records because they seem to have the least complications. CNAMES make me uncomfortable in part because I don't fully understand them.
The first part of my question... should I be concerned about CNAMES if I'm using A Records to set up the names the CNAMES are aliasing? I use mod_rewrite on the web host to write everything to the "www" canonical form.
Re wildcard DNS... in the past, I used a wildcard DNS subdomain setup in addition to the "www", to take care of typos, and then used mod_rewrite to get all variants to "www" form.
About a year ago, though, soapystar discovered that "%20www" didn't get redirected properly, as discussed in this thread....
301 rewite for all improper server prefixes
%20www. redirect
[webmasterworld.com...]
We couldn't find a fix for the problem, and the eventual solution was to remove the wildcard from the DNS. So, instead of the wildcard, for this site I'd been planning to set up A Records for the root record, as well as for w, ww, www, and wwww, which would cover the most likely typos for "www".
I'm told I can set CNAMES for all of these and incur no A Record fail-over monitoring charges. Any reason not to?
Also... beyond the immediate issue of fail-over monitoring charges, what are thoughts about best practices in this situation?
We couldn't find a fix for the problem, and the eventual solution was to remove the wildcard from the DNS. So, instead of the wildcard, for this site I'd been planning to set up A Records for the root record, as well as for w, ww, www, and wwww, which would cover the most likely typos for "www".
We're using a DNS management company to provide third-party DNS hosting, in this case all for one site whose canonical form will be...
http://www.example.com/ example.com will be defined by an A Record. The CNAMES will map...
w.example.com to example.com
ww.example.com to example.com
www.example.com to example.com
wwww.example.com to example.com These will then be rewritten by mod_rewrite on our web hosting account to our preferred canonical form...
http://www.example.com/ I hope this is clearer. The question is whether it's worth springing the extra bucks in this case (because of the fail-over monitoring charges) and use all A Records instead of the CNAMES. The CNAMES won't cost us anything, whereas the A Records will cost $5 ea per year.
Beyond that, whether or not we have the fail-over charges, would CNAMES for these aliases, rather than A Records, be a good practice or a bad practice... and will they affect our mod_rewrite in any way?
Other than that, you cannot use a CNAME for a name requiring an SOA record (e.g. your basename), or for a name that is also used in an MX record.
No other reason for not using them.
Since www will be your primary, I'd consider using an A record for www if you want the very fatest speed delivering the first page. (After that it is moot due to cacheing.) No reason not to use CNAMEs for ww, wwww, etc. since would won't be terribly concerned with speed there.
FWIW, but something to keep in mind if they do anything else that makes you question their tactics.
charging per A record is like charging per email alias
If it is the company I am think of, what they are charging for is failover monitoring.
They constantly check a website to see if it is up. If it is not up, they modify the A record to point to the backup site. That's just how the service works - one website monitored, on A record modified.
So, if you wanted a second A record modified, you'd have to set up an entirely seperate failover-monitor.
Alternately, if you have CNAME records that point to the domain named used in the A record, you can switch them all over with just one failover-monitor.
I'd use the CNAMEs, unless you really want the very fastest speed. Then I would have two A records - one for www and one for the basename. All the others (ww, wwww, etc.) can be CNAMEs.
Finally, you could always just change your primary to the basename. Make www, ww, wwww CNAMEs, and just change the A record for the basename with the failover-monitoring. This is more consisten with "modern" standards, anyway. Many consider the "www" to be an anachronism.
If it is the company I am think of, what they are charging for is failover monitoring.
For failover monitoring, if the price is actually $4.95 for each record monitored (above those included in the regular fee), then I suspect it's also the company I use (and very highly recommend). Their FO service has switched my servers a couple of times when I was asleep, and sent me a little text message to my cell phone to let me know :)
My bad... my reading comprehension needed its own failover monitoring <g>. Thanks for the clarity adjustment!
If it is the company I am think of, what they are charging for is failover monitoring.
Yes... it is the company we're all thinking of; and it is failover monitoring they're charging for; and $4.95/yr is the price per year for each additional A Record monitored, to the penny. ;)
I'd use the CNAMEs, unless you really want the very fastest speed. Then I would have two A records - one for www and one for the basename. All the others (ww, wwww, etc.) can be CNAMEs.Finally, you could always just change your primary to the basename. Make www, ww, wwww CNAMEs, and just change the A record for the basename with the failover-monitoring. This is more consisten with "modern" standards, anyway. Many consider the "www" to be an anachronism.
jtara - Thanks for your feedback. I like using "www," btw, largely for marketing purposes. It's much easier to say "www" than it is to say "h," "t," "t," "p," "colon," "front-slash," "front-slash." I think the general public gets the "www" much more readily.
Per your suggestion, I'm now inclined to use two A records, one for www and one for the basename, plus the CNAMES.
A further question about the CNAMES, perhaps academic because I'll be using mod_rewrite... but since my objective is to end up with www.example.com, should the w, www, and wwww CNAMES map to example.com or to www.example.com?
[edited by: Robert_Charlton at 5:35 am (utc) on Sep. 30, 2006]
w, www, and wwww CNAMES map to example.com or to www.example.com
So, if you they try w.example.com, the DNS server will say, hmmm... that is a CNAME for www.example.com (or example.com), and the IP for www.example.com is 123.223.13.12. You get the exact same process, and the exact same results if you switch example.com with www.example.com in that process.