4

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

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

we also have an SSL cert for www.domain.com.

the issue is that if someone goes to https://domain.com/secure_stuff, 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 https://www.domain.com, 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?

3 Answers 3

2

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 www.example.com then perform a permanent redirect to www.example.com 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 ^(.*)$ http://www.example.com/$1 [R=301,L] 

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

0
1

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

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

0

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 http://wwwizer.com/naked-domain-redirect

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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