0
votes

I'm posting this because none of the other questions related to Namecheap/Heroku have helped me.

It doesn't seem to be possible to have a configuration where both of these are true:

  1. https://example.com, https://www.example.com, http://example.com, http://www.example.com all end up loading the site
  2. Emails get routed correctly to [email protected]

The reason this doesn't seem to be possible is that in order for MX email records to work on Namecheap, there must not be a CNAME record for the naked domain. But for https://example.com to work, Heroku requires that I set up a CNAME for the naked domain (host @ with value example.com.herokudns.com)

I tried using a URL Redirect record for the naked domain that goes to https://www.example.com but this does not cover the https://example.com case. But that's the closest I've come to having all cases working.

I ultimately don't care if a redirect happens to the www. version. I just need content to load for both naked and non-naked domains and for both https and non-https cases.

So aside from switching off of Namecheap, how can I get all the domains loading correctly and have email working as well?

1
You can't, not without changing name service provider (devcenter.heroku.com/articles/…). Why would you insist on staying with Namecheap? - Dusan Bajic
The only reason is I have a dozen domains with them so it's a pain to move off. I can do it if necessary though. Which alternative do you recommend? - Maros
For heroku, you should probably pick one from from the above devcenter artilce (you don't have to change registrar, only name servers) - Dusan Bajic

1 Answers

0
votes

So this configuration is now possible with namecheap/heroku.

Instead of choosing CNAME record type, pick ALIAS for the naked domain. Namecheap example of advanced DNS line would be like this:

(Type)            (Host)           (Value)                                (TTL)
ALIAS Record      @                heroku-weird-dns-target.herokudns.com  5 min

ALIAS will play along with both TXT and MX.

To have www working, just add the www.[yourdomain].com to heroku and set up a CNAME for the www on namecheap:

(Type)            (Host)           (Value)                                (TTL)
CNAME Record      www              heroku-dns-www-target.herokudns.com     Auto

Now the http to https redirects should be handled by your application. Also I would only use one of www or naked, and have the other rewrite url or redirect in the application.