Mobile app version of vmapp.org
Login or Join
Cooney921

: DNS configuration to force root domain to www 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

@Cooney921

Posted in: #Dns #Heroku #Https

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 domain.com -> specific host name for our app provided by heroku

we also have an SSL cert for domain.com.
the issue is that if someone goes to 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 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?

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Cooney921

3 Comments

Sorted by latest first Latest Oldest Best

 

@Cofer257

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 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 equivalent.

10% popularity Vote Up Vote Down


 

@Ravi8258870

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


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

10% popularity Vote Up Vote Down


 

@Annie201

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

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

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme