Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm told that I can't make the root of a domain (example.com) a CNAME - I have to specify an IP.

Given that you can't use an IP address to point at your Elastic Load Balancer, what's the best thing to do?

Currently I do this:

example.com - A record to elastic IP of first server- redirects to www.example.com

www.example.com CNAME to hostname of load balancer

If the first server is out of action, the redirect will fail.

Is there a better way to approach this?

share|improve this question
add comment

3 Answers

your approach is probably the most sane one.

what you could do is Round Robin DNS your root record by just adding multiple A records for the example.com. domain and replicate the redirection code accross all your servers. this way its not so reliant on the first server.

if your redirect is a 301, virtually all users will cache the 301 so likely next time they view the site if they went via example.com there browser should (if they dont clear cache) auto redirect to www.example.com without even checking the servers and then go straight to your load balancer

share|improve this answer
    
We do exactly this. There is some hope the Amazon's DNS server will solve the redirect to www.domain problem, but until then this is the best way to do it. –  kashani Mar 17 '11 at 0:33
add comment

Looks like Amazon have now implemented a solution for this.

"Amazon Route 53 has integrated with Amazon EC2’s Elastic Load Balancing in order to easily let you map your root domain, or “zone apex” (e.g., mydomain.com, without the ‘www’), directly to your Load Balancer."

http://aws.typepad.com/aws/2011/05/elastic-load-balancing-ipv6-zone-apex-support-additional-security.html

share|improve this answer
add comment

I have found that most domain registrars offer basic DNS tools with domain redirection (HTTP 301) and thus you should be able to set your root entry (e.g. example.com) as a redir to www.example.com or the like. This is all assuming that you are ok with the redir and don't need your site to respond to example.com. This would keep you from having to pay for another elastic IP as Amazon.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.