Sign up ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

we have an app running on heroku. the dns setup is like this:

A record for -> heroku front end ip addresses CNAME for -> specific host name for our app provided by heroku

we also have an SSL cert for

the issue is that if someone goes to, they will get heroku's SSL cert, instead of ours, causing lots of fear. We can do things on our end to make sure that all of our URLs point to, but it still won't solve this specific issue.

is there a way to configure the DNS record to redirect all root domain traffic to the www subdomain?

share|improve this question

3 Answers 3

Heroku's support site does address the situation you're facing, which may help you with the problem.

On a couple of my sites, I solved the multiple domains/naked domain problem with a positive compare, i.e. if the domain is NOT then perform a permanent redirect to as this takes care of all issues in a very simple way.

RewriteEngine On
RewriteBase /

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
RewriteRule ^(.*)$$1 [R=301,L] 

This question 'What is the best way to redirect my naked domain' addresses using DNS to solve the problem.

share|improve this answer
the heroku solution for this is actually discouraged by heroku, which is just using a different SSL option that they offer and A records. the issue with what you're proposing is that it still happens after the SSL handshake, which means that if someone got a hold of they would get a security warning, as the rewrite stuff wouldn't kick in yet. – kolosy Mar 13 '12 at 15:43

Your SSL certificate should cover your www and non-www version of your domain. From GoDaddy their Standard SSL says, "1 certificate protects AND"

And instead of a CNAME to your www why not an A record or @ to direct requests to www?

share|improve this answer

Try using a naked domain redirect service. I run my own EC2 redirector to do this for my sites that require it (S3 static web hosting for example), and free ones exist such as

Point your zone apex to the IP they give you (A record) and when you hit the naked domain in a browser, you'll be redirected to the www. equivalent.

share|improve this answer

Your Answer


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.