How to do DNS Set up / cname flattening with heroku and Godaddy - ruby-on-rails

I have application deployed in Heroku with Godaddy domain.
After trying several methods done dns setup.
Add CNAME www with value DNS target provided by heroku.
This is working fine for domain with www. But I like to open domain without www(naked domain). which is not working currently.
What I have already tried and nothing worked for me.
Add CNAME with name(naked domain) and value(heroku app url)
(a) Add a Domain with naked domain name(domain name without www)
(b) Add CNAME with name(naked domain) and value(heroku app DNS Target
value from(a))
Add Forwarding https:// with www.domain-name
Then tried configure DNS setup in cloudflare there everything problems got resolved, But there website's speed got slow and even some JS was not working. Tried several code changes and deployment, Nothing worked so finally back to GoDaddy for DNS Setup.
Somewhere got to know that CloudFlare provide CName flattening which GoDaddy not. Due to CName Flattering Redirection works fine with CloudFlare.
Please suggest me steps to resolve this. domain URL

Got response from Heroku team.
Redirecting from root domain [http://mysite.in/] to sub domain [http://www.mysite.in/] can be done at application level or on your DNS provider [GoDaddy] settings. Heroku or any other similar platforms won't have such an option.
Heroku recommends you to point the root domain to its DNS target with an ALIAS/ANAME record type. Unfortunately, Godaddy doesn't give that option. The root domain's DNS target can be an IP address as well, but the IP addresses of your application on Heroku keeps changing, at least once a day, so you can't use that as DNS target. We have an article on how you should set up the domains for a Heroku app, please give it a read https://devcenter.heroku.com/articles/custom-domains and let me know if you have any question there.
So the options you are left with is to make use of an add-on like Quotaguard which will give you a static IP address against your Heroku application, this IP can be used as DNS targets or change the DNS provider, we have a list of DNS providers which support ALIAS/ANAME record type.

Related

1&1 domain pointing to Heroku

I am aware that there have been a few discussions on this one but none have given a definitive answer. I am hoping this will help me and others.
Problem:
I have a domain name (www.xyz.com) registered with 1&1.
I want users to be able to type this in and be shown my website. A Heroku web app.
I want the domain name (www.xyz.com) to be displayed. Not any subdomain url or the heroku app URL.
I do not want the set-up do be anything that will have a detrimental impact on SEO.
Note: I have just got off the phone with 1&1 and they have said that my only options are to do a frame redirect or a http forward. Neither of these meet the above requirements.
Additionally, other posts have suggested finding out what the Heroku IP address is and using this but Heroku recommend against this as they might change it without notice.
Please could I ask that any one kind enough to respond spells things out a little. Anyone having problems with redirects is likely to be new to this.
Thanks.
never used the 1&1 services, but solving your problem is pretty straightforward.
Take the following steps:
Add you domain to heroku. heroku domains:add www.xyz.com . If you have more than 1 app in your heroku account, remember to pass the --app flag
Now you should have something like myherokuapp.herokuapp.com where myherokuapp is the name of your app on heroku
Go to 1&1 and create a CNAME record pointing to myherokuapp.herokuapp.com
I found this video to be helpful - https://www.youtube.com/watch?v=ZLVBBAnrrL4
Basically, as noted by #Kevin Lawrence above, you use the 'www' subdomain.
I've never used 1&1 but my DNS provider (dreamhost) does not allow CNAMEs on the main domain name either. It does however allow me to create a CNAME for the www subdomain which was good enough in my case.
I did this:
heroku domains:add www.mydomain.com
create a CNAME record pointing to mydomain.herokuapp.com
Have mydomain.com redirect to www.mydomain.com
It's not exactly what I wanted (or what you want) but it works.
What worked for me was to user Namecheap.com's FreeDNS service that provides free automatic redirect for your TLD and subdomains directly to Heroku, while keeping your domain visible:
example.com and www.example.com now point to exampleapp.herokuapp.com
I had to have a live chat with Namecheap's support to complete the domain verification process, but they answered really fast! Love to namecheap, 1and1 is really crappy, moving my domains away soon. :)
I got this to work properly! No need for CNAME at all. Create a A record in heroku like in this link - creating a custom room domain - provided by heroku (of course, change example.com to your root domain):
heroku domains:add example.com
Here, example.com is the ROOT domain. Once you get an A record, execute the following command
heroku domains:wait example.com
Now verify your domain has been provisioned:
heroku domains -a [your custom heroku app name]
And you get this:
=== [your custom app name] Custom Domains
Domain Name DNS Record Type DNS Target
example.com ALIAS or ANAME elliptical-blueberry-1euo3460fyrtc8zdgulv0f7o.herokudns.com
Next, get the IPv4 IP address of elliptical-blueberry-1euo3460fyrtc8zdgulv0f7o.herokudns.com I got it by using a lookup service.
Updating 1 and 1
Go to 1and1.
Click the DNS tab for your custom domain e.g. example.com
Delete the existing A record
Create a new A record and enter in the # symbol if it asks you, or else I think it is the default AND enter in the IPv4 address
For testing this out, make the TTL 1 min until it's stable
Give it time to propagate. Could be a few minutes to 24 hours.

Point Domain Registered Through iPage to Heroku App

I've got a domain (and hosting account) with iPage.
I'd like to point this domain example.com and www.example.com to my heroku app - which is currently available at example.herokuapp.com.
I've set up a CNAME (Alias) as follows:
host: www
points to: example.herokuapp.com
I've gone through Heroku's documentation for custom domain names; however, I've been unable to make it work.
What do I need to do differently?
The reason you are not able to access your site at www.example.com even after setting up the DNS correctly is you have not updated your application setting inside Heroku. You need to provide Heroku with the web address want to host your site, this you can do inside your Application Settings page.
Heroku does not support apex domain so you might want to setup a redirect from example.com to www.example.com, I don't see why you would want to run your site on two web address. But you really want to run your site on two addresses you can try zerigo dns addon on heroku. Zerigo dns can also help you setup the redirect.
https://devcenter.heroku.com/articles/apex-domains

1and1.com to Heroku

Edit: Just to be clear, actually I only want to use a different webserver, not mail server. It has to stay the same.
I've got a 1and1 plan including webspace and email service. As 1and1 doesn't support Ruby, I created my website at Heroku.
I'm now trying to point my www.example.de url to my example.herokuapp.com domain. As this is the very first time I'm doing this, please alert me if I'm missing something important.
The website uses the 1and1 mail server. I found out that, due to that fact, I can't go the cname way but need a A Record (or ANAME Record?). I already pointed heroku to the right urls and now need to set up 1and1 and a dns service.
I registered at dnsmadeeasy.com and created an ANAME Record:
Name: [left blank]
FQDN or IP: myapp.herokuapp.com
TTL: 1800 (I've got no idea what that is)
After creating that, dnsmadeeasy.com shows me several "System NS Records" which look like nameservers?
ns0.dnsmadeeasy.com
upto
ns4.dnsmadeeasy.com
As far as I understand I now have to enter the nameservers above at 1and1.
My question now is, does this disable the by default working mail server connection? If yes, how would I point back to it from dnsmadeeasy.com? Or is there a better way to do this?
It seems the easy way to do it now is with Point DNS. They have a free developer plan: https://devcenter.heroku.com/articles/pointdns
Enter the Point DNS servers into the 1and1 Domain Manager.
The problem was solved by just adding a A-record at 1and1 pointing at Heroku. No nameservers or any extra service needed.
Here is a more detailed update:
First you have to go to the Heroku app settings. There you can add domains for your app, like www.mydomain.com.
Then you use a service to get the IP address of the server where your Heroku app instance is running. (Just get the IP address of your instance of yourapp#herokuapp.com.) Then you add this IP address as a A-record to the 1and1 app settings. Now you have to wait for the settings to propagate over the DNS servers.
Basically you point your 1and1 app to the server on which your Heroku app runs and inform your Heroku app that there probably is some app trying to reach through to it, which has a specific address, like www.mydomain.com. That's how they find each other.

Naked Domain with Heroku and BigRock

I have my domain name example.com from domain registrar BigRock, which also provides me the DNS management panel.
My application is hosted at Heroku at example.herokuapp.com.
Domain Settings at Heroku:
bash-3.2$ heroku domains
=== MyApp Domain Names
*.example.com
example.herokuapp.com
example.com
www.example.com
In my DNS Management panel, I have 0 A records, 1 MX records for Hotmail and 1 CNAME record for www.example.com.
I know about the problem with Naked domains and A-records with Heroku.
I have gone through these:
1. StackOverflow ques - How to setup DNS for an apex domain (no www) pointing to a Heroku app?
2. Heroku DevCenter - Custom domains - set up root domain
3. Heroku DevCenter - Apex Domains
The above links and many others point towards 2 solutions:
Using ALIAS or ANAME records by DNSimple/ DNS Made Easy
If your DNS provider does not support such a record-type, and you are unable to switch to one that does, you will need to use subdomain redirection to send root domain requests to your app on Heroku.
Since, I couldn't find such records on BigRock DNS Management Console. There were only these records - "A, AAAA, MX, CNAME, TXT, SRV and SOA".
Accordingly, I have setup "Domain Forwarding" for my domain. But, it only gave me option to provide "Designation URL where you wish to forward requests for www.example.com and example.com".
Now, If I do
bash-3.2$ host example.com
example.com has address 173.194.16.11
example.com mail is handled by 15 888379351a9a.pamx1.hotmail.com.
and
bash-3.2$ host www.example.com
www.example.com is an alias for example.herokuapp.com.
This does solve the naked domain problem. But other subdomains like xyz.example.com are still not redirected to www.example.com, because
there is no mention to redirect all subdomains i.e "*" to any other designation in the "Domain Forwarding" section on BigRock DNS provider.
So, my question is how can I solve this problem of redirecting sub-domains?
Another Query Related to SSL -
Here in the Heroku Devcenter - subdomain redirection, it says that
"However, be aware that, using this method, a secure request to the root domain, e.g., https://example.com, will result in an error or warning being displayed to the user."
Is there any way of fixing the above issue, or do I have to switch to DNSimple or DNS Made Easy to use the ALIAS or ANAME records services they provide?
UPDATE:
On further digging, I found this SO ques - Rails Manually redirecting from Naked Domain, which suggests using:
Rack_rewrite
Refraction gem
Is this a better way?
Once you setup a domain forward in BigRock DNS panel, you will see two A records like example.com => 173.193.106.11 and www.example.com => 173.193.106.11. The same way if you create wildcard dns A record, it will redirect for all the domains. i.e *.example.com => 173.193.106.11
I am not sure if the IP is same in your case because Bigrock might be using multiple servers to offer this service.
Linode do not offer naked domain ANAME records either. A solution I have found is to add a www.site.com CNAME record for the Heroku app as normal. Then point the naked domain/catch-all A record to the following IP address:
174.129.25.170
This is a free naked domain redirect service offered by wwizer. It will take your naked domain, and simply redirect it to a www. equivalent:
site.com => www.site.com
Hope this helps.
Try adding your domain name with www in the 'Destination' of Domain Forwarding Panel.
Later, remove the A record for www. Hence, there will only be 2 A records
i.e for naked domain and wildcard (*)
Then add a CNAME record for www pointing to the HerokuApp value.
Do let us know if you are facing any issues.
You have to do Domain Forwarding of your site from naked domain to www sub domain. This features available next to Manage DNS feature. Once the dialog open, just enter your www subdomain(www.example.com). After 6 to 8 hours(sometime it take 1 day), It will automatically add an A record for your naked domain(example.com) points to ip 173.193.106.14.
For e.g. kanhaiyakumawat.com and kanhaiyakumawat.herokuapp.com
Here are the steps
Add records in your heroku account for
www.kanhaiyakumawat.com to kanhaiyakumawat.herokuapp.com
kanhaiyakumawat.com to kanhaiyakumawat.herokuapp.com
*.kanhaiyakumawat.com to kanhaiyakumawat.herokuapp.com
So now with this heroku side setup is done. Lets move to bigrock 'DNS Management' section. Click 'Manage DNS'.
Add CNAME Records
www.kanhaiyakumawat.com to kanhaiyakumawat.herokuapp.com
*.kanhaiyakumawat.com to kanhaiyakumawat.herokuapp.com
MOST IMPORTANT: Setting up Naked Domain or root domain Setup
Now this is most trickiest part. Just leave the 'hostname' text box
empty and select 2nd radio button in Values.
Put here your heroku dns value e.g. kanhaiyakumawat.herokuapp.com
Same steps are available here:
http://kanhaiyakumawat.com/blog/heroku-and-bigrock-dns-setup/

heroku recognizes 'myapp.com' but not 'www.myapp.com'

Just like it says in the title, I followed heroku's instructions and added 'myapp.com' and 'www.myapp.com' as domains for my heroku app.
The former works correctly but the latter does not. Any ideas? EDIT: When I point my browser to 'www.myapp.com', I get an error from Comcast, my ISP, saying that the URL was not found.
You can do this 2 different ways:
First way:
In your heroku custom domains add www.myapp.com.
In your DNS point the www CNAME to proxy.heroku.com
Second way:
Have you subdomain redirect to myapp.com
You followed the part about DNS setup and setting up a CNAME for www.myapp.com? If so and you just set it up, it can take as many as 48 hours for all the DNS servers to update.
If that's not the case, make sure you have your CNAME record set up correctly with the domain's host so it knows about the www subdomain.

Resources