2

I have a domain, flyh2.com.

I use a CNAME to forward www.flyh2.com to flyh2.elasticbeanstalk.com where my web site is hosted. This is the only way Amazon allows custom domain names. A records aren't allowed.

I'd like people to simply type http://flyh2.com (without the www) and still have visitors see my web site.

Originally I used CNAME to forward both the naked and the www records to my web site, but it seemed to cause problems.

Incoming mail was being returned to sender:

Fwd: Returned mail: see transcript for details
<[email protected]>... Deferred: Connection timed out with flyh2.elasticbeanstalk.com.
Message could not be delivered for 6 hours
Message will be deleted from queue

Seems that the CNAME on the naked domain was overriding the MX records.

Now I've changed the CNAME on the flyh2.com record to point to www.flyh2.com and in turn www.flyh2.com to CNAME to flyh2.elasticbeanstalk.com.

My MX records are set up correctly, but the CNAME on the naked domain seems to override them. Do I have to use an A record?

6
  • How is your zone set up, I used to put in an A record for my unprefixed domains pointing to the web server that hosted the site..
    – NickW
    Feb 17, 2014 at 11:30
  • I fear you may be quite badly confused. flyh2.com is not an unqualified domain name; www is an unqualified domain name. That said, you may find that looking into MX records helps you solve your problem. And thank you for not redacting the domain name, at least!
    – MadHatter
    Feb 17, 2014 at 11:31
  • @NickW I can't use an A record. It has to be a CName. Feb 18, 2014 at 12:57
  • @MadHatter, I changed my terminology to naked domain. I hope that's more correct. Feb 18, 2014 at 12:58
  • 1

3 Answers 3

11

You cannot have a CNAME for the domain.

CNAMEs can only exist as single records and not combined with any other resource records. Since a domain always has a SOA and NS record, you cannot use a CNAME for the domain. This is specified in RFC 1034, section 3.6.2.

The reason that email specifically breaks is found in RFC 5321, section 5.1:

That domain name, when queried, MUST return at least one address record (e.g., A or AAAA RR) that gives the IP address of the SMTP server to which the message should be directed. Any other response, specifically including a value that will return a CNAME record when queried, lies outside the scope of this Standard. The prohibition on labels in the data that resolve to CNAMEs is discussed in more detail in RFC 2181, Section 10.3.

In other words - as long as your provider does not allowed A records, what you want cannot be done.

6
  • This doesn't even apply because 'www' is a subdomain.
    – Peter
    Feb 19, 2014 at 8:38
  • 1
    Yes, 'www' is a subdomain. However, the question is how to use a CNAME for the domain itself, in addition to the subdomain.
    – Jenny D
    Feb 19, 2014 at 9:09
  • In that case, OP is very bad at explaining this. The sentence "I use a CName to forward www.flyh2.com to flyh2.elasticbeanstalk.com where my web site is hosted. This is the only way Amazon allows custom domain names. A records aren't allowed." conveys that the issue is with the subdomain.
    – Peter
    Feb 19, 2014 at 11:39
  • 4
    Try reading the rest of the question.
    – Jenny D
    Feb 19, 2014 at 13:26
  • 1
    Now using an A record to point the naked domain to a free redirect service - wwwizer.com/naked-domain-redirect - working like a charm... Feb 21, 2014 at 9:51
2

It doesn't sound like you know the correct definition of FQDN. It also doesn't sound like you know what a CNAME is for.

You will need to add in an MX record for your domain if you plan on sending mail there. Make sure that is added correctly and that your server is correctly configured to process mail.

2
  • Read up on FQDN. True. I was confused. I have to use CNames. Thats how Amazon Web Services works. The MX records are set up correctly and working. Mostly. Feb 18, 2014 at 13:00
  • I understand CNAMEs. Your post if quite difficult to understand so sorry if I misunderstood you.
    – Peter
    Feb 19, 2014 at 9:40
1

The solution is buried in the comments and not explained well. Here is the full solution from Micheal Hampton:

  1. Setup a CNAME from www.flyh2.com to flyh2.elasticbeanstalk.com. When using www. this will redirect web requests to the Amazon web server.
  2. Setup an A Record from flyh2.com to 174.129.25.170. That IP has a web server that redirects naked domains to www. subdomains. This will redirect web traffic from the naked domain flyh2.com to www.flyh2.com. www.flyh2.com will redirect to flyh2.elasticbeanstalk.com (because of the cname above.)
  3. Setup a MX record from flyh2.com to its mail server. Mail sent to flyh2.com will ignore the CNAME since it only applies to www.flyh2.com. The mail will ignore the A record and instead use the MX record, which points at the mail server. Web traffic will go to elasticbeanstalk and mail to the mail server.

Not the answer you're looking for? Browse other questions tagged .