Confirguring Namecheap + Namecheap MX Records + Heroku HTTPS - ruby-on-rails

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:
https://example.com, https://www.example.com, http://example.com, http://www.example.com all end up loading the site
Emails get routed correctly to contact#example.com
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?

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.

Related

If I have a www domain pointed to Wix, can I point a sub-domain to Heroku and how would that affect SSL?

I have my website's www domain pointed to a Wix site, but am looking to point a sub-domain to my Heroku app. The domain was purchased from Yahoo Small Business.
i.e. if www.mysite.com points to Wix, can subdomain.mysite.com point to a heroku app with no issues?
My confusion is because of this line in the Heroku docs:
Root domains must be added in addition to any subdomains.
Will adding the subdomain to Heroku mess up the domain on Wix somehow?
In addition, would Heroku still be able to automatically handle the SSL certificates etc. if I do direct the sub-domain to Heroku?
The quote you reference is in relation to adding root domains. Since you want to point a subdomain at heroku that does not concern you.
The part you are interested in is this part: https://devcenter.heroku.com/articles/custom-domains#add-a-custom-domain-with-a-subdomain
Basically you want to tell heroku you will add a custom subdomain (follow the instructions) then you need to configure your DNS records to add a CNAME (this part gives some examples):
Record Name Target
CNAME www whispering-willow-5678.herokudns.com.
CNAME othersubdomain autumn-sunset-1495.herokudns.com.
CNAME examplesecure example-2121.herokussl.com.
CNAME examplesecure-eu example.herokuapp.com.

URL Redirection and 1and1

I've got an app up and running on Heroku. I've purchased a top level .com domain from 1and1 (I have other sites there, so I thought that would make life easier).
When I attempted to redirect to my Heroku app, I was not allowed to modify the CName alias record like I have done for other sites - which were all subdomains. I was given two options: Frame redirect or HTTP redirect, I've tried both. The frame redirect doesn't seem to function at all - the page stays blank. The HTTP redirect does actually get to my heroku site, but when it displays the address bar shows myproject.herokuapp.com instead of mydomain.com.
I've added both the www.mydomain.com and mydomain.com to my heroku domains.
Is there anyway to add a mask or similar?
Short answer: you can not set CNAME for top of your domain.
Detailed answer: Why can't a CNAME record be used at the apex (aka root) of a domain?
Some DNS providers might offer workaround hacks.

How to point Site5 domain name to Heroku

I am trying to point custom domain name from Site5 to heroku domain. I am following this guide: https://devcenter.heroku.com/articles/custom-domains
Inside my Site5 control panel I choose Advanced DNS Zone Editor and inserted the following values:
Record type: CNAME
Record name: www
CNAME host: stark-plains-xxx.herokuapp.com
I saved those values but there is no change when I access my site www.mysite.com. There is still default index on front page.
Command host www.mysite.com only gives an IP address of my site.
Have I done everything correctly? Thank you.
I just want to answer my own question. That process I described is correct for www. It just needs a little bit more time to get it work.
So, for www.mysite.com these are correct values inside Site5 control panel -> Advanced DNS Zone Editor:
Record type: CNAME
Record name: www
CNAME host: stark-plains-xxx.herokuapp.com
For mysite.com, procedure is a little bit different because you can't delete default values. In this case simple redirect is needed. On Site5 dashboard we need to choose Domains -> URL Redirects and put the following values:
That's it. Now both www.mysite.com and mysite.com will redirect to our site hosted on Heroku.

Domain Mapping in WPMU

I'm running WordPress MultiUser and a plugin to allow for domain mapping.
I have a subdomain site subdomain.domain.com
and I want domain2.com to point to it.
My tech buddy double checked my WP settings and said everything was good there.
When I go to my existing subdomain.domain.com site I am now redirected to domain.com registration page.
When I go to domain2.com I get the following:
The page isn't redirecting properly
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
Prior to the domain mapping attempt the sub.domain.com site worked fine
with sub.domain.com defined in Plesk as an alias of domain.com
I have domain2.com refined in Plesk as an alias of domain.com
I was told to have domain2.com made into an alias of sub.domain.com
but I don't see how to do that in Plesk.
Cloudflare is redirecting the domain2.com to the server correctly.
What am I missing?
It is probably best to contact CloudFlare so we can actually look at the zone file & then check any redirect rules on your server.
Just a quick note that mapped domains need to be added as individual domains, if not a subdomain of root domain, so that's why it is important for us to look at the zone file. If you're simply adding subdomains to a domain already added, then that is a different issue (WPMU plugin is also available through outside developer that only works for subdomains).

Redirecting subdomain for static assets on Heroku

I would like myapp.com/blog to redirect to www.myapp.com/blog. I've installed Refraction to do subdomain redirects at the Rack layer. That doesn't work on Heroku for /blog since my files in /blog are static assets. Any fix?
Sounds like you may be making this more difficult than it needs to be.
If you just want myapp.com/something to redirect to www.myapp.com/something, then goto the domain host that is currently handling the myapp.com domain and create a URL redirect record to do just that. This way, the redirect happens at the domain registrar before it even touches your Heroku server (which is how it should be handled).
An example of this would be to create the following records at your domain registrar (i.e. GoDaddy, NameCheap, etc): http://i.imgur.com/FJrMV.png
Those 3 IP addresses point to Heroku's servers. You should have already set up the custom domain add-on within Heroku if indeed you have some site similar to myapp.com and not myapp.heroku.com
Here's an article / video from Heroku that deals with a little bit of this as well: http://devcenter.heroku.com/articles/custom-domains

Resources