1and1.com to Heroku - ruby-on-rails

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.

Related

How to do DNS Set up / cname flattening with heroku and Godaddy

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.

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.

How to point a domain at a heroku application

While I've done this on my VPS, I've never done this for a heroku application, and now I have to do it for a fairly large company so I really want a simple list of bullet-points in how to do this.
I've read these instructions, and I'm still a little bit unclear on what exactly they mean. Again, if I had more time I'd buy some rubbishy domain and test it myself, but I don't have time on my side and need to get this right first time!
Thankfully, no SSL is required at this time.
Here's what I can gather I need to do to point the url www.foobaryfoobs.com at my application, running at warm-chamber-1882.herokuapp.com. Please correct me:
1) I add www.foobaryfoobs.com to the local repository containing the application.
I presume I do this by navigating to the repository on my local machine and running:
$ heroku domains:add www.foobaryfoobs.com
How does this work? Does it update some configuration file somewhere that I need to add to the repository and then push up to heroku?
Are there any caveats or best practices here? What other domains should I add? heroku domains:add *.foobaryfoobs.com, for example?
Heroku advises we use the above wildcard domain here. Why?
2) Log into the registrar that created www.foobaryfoobs.com and navigate to its control panel.
3) Update the domain's CNAME record to point at warm-chamber-1882.herokuapp.com
Am I done for the most part? Now do I just wait?
Is there no IP related stuff?
The domain has several dozen emails attached to it. As long as I don't touch the MX record, I should be fine?
What's a root domain? Why should I add it?
Why should I care that:
Some DNS hosts provide a way to get CNAME-like functionality at the
zone apex using a custom record type.
4) Update the domain's FORWARD / URL record so that foobaryfoobs.com points to www.foobaryfoobs.com
For a nooby, please explain why this is necessary.
3 Conclusive Questions:
1) Is this how it should be set up?:
The app:
warm-chamber-1882.herokuapp.com
Should have the following configurations (saved in some weird config file that I wouldn't mind knowing more about about):
domains:
www.foobaryfoobs.com
*.foobaryfoobs.com
The domain:
www.foobaryfoobs.com
Should have the following records:
CNAME: warm-chamber-1882.herokuapp.com
URL / FORWARD: foobaryfoobs.com target: www.foobaryfoobs.com
MX: *as long as I don't touch them the emails will still work*
2) Am I covered against:
It’s important to make sure your DNS configuration agrees with the
custom domains you’ve added to Heroku. In particular, if you have
configured your DNS for *.example.com to point to
example.herokuapp.com, be sure you also run heroku domains:add
*.example.com. Otherwise, a malicious person could add baddomain.example.com to their Heroku app and receive traffic intended
for your application.
3) How should I adjust the steps for a site that has an SSL backend section?
A.
$ heroku domains:add www.foobaryfoobs.com
How does this work? Does it update some configuration file somewhere that I need to add to the repository and then push up to heroku?
I dont know exactly how does it works internally but this command is equivalent of adding ServerName in apache config file, without this when request comes to www.foobaryfoobs.com it will be forwarded to heroku because of dns but heroku fail to determine your app. You will see the below image.
That's why they need your domain so they know which apps belongs to which domains. They also need it for domain precedence purpose. No changes are required in your code as long as you are okay to allow your user to access Heroku subdomain ie warm-chamber-1882.herokuapp.com. If you dont want user to access heroku subdomain you have to pass 301 http status so it will be redirected to your actual domain i.e www.foobaryfoobs.com . For this you have add this in your application controller
before_action :forward_to_domain_if_heroku_subdomain
private
def forward_to_domain_if_heroku_subdomain
if request.host == 'warm-chamber-1882.herokuapp.com'
redirect_to "http://www.foobaryfoobs.com" , status: 301
end
end
Are there any caveats or best practices here? What other domains should I add? heroku domains:add *.foobaryfoobs.com, for example?
if you ONLY want to use www.foobaryfoobs.com as your domain, this command is suffice ie
heroku domains:add www.foobaryfoobs.com
If you want to assign naked domain foobaryfoobs.com then you ALSO have to run
heroku domains:add foobaryfoobs.com
If you application use subdomains like subdomain.foobaryfoobs.com then you also have to run
heroku domains:add foobaryfoobs.com
2) Log into the registrar that created www.foobaryfoobs.com and navigate to its control panel.
To be precious, you have to do DNS management tool.
3) Update the domain's CNAME record to point at warm-chamber-1882.herokuapp.com
Yes.
Am I done for the most part? Now do I just wait?
Yes, but there are also other things.
Is there no IP related stuff?
Yes, there is no ip related stuff.
The domain has several dozen emails attached to it. As long as I don't touch the MX record, I should be fine?
Yes.
What's a root domain? Why should I add it?
if you want to accept requests from user at warm-chamber-1882.herokuapp.com (not www. warm-chamber-1882.herokuapp.com) then you have to add it.
Why should I care that:
Some DNS hosts provide a way to get CNAME-like functionality at the zone apex using a custom record type.
Yes. They are talking about ALIAS or ANAME type of records. (DNSimple provides it). You have to care it because from that custom-record-type it is easily to add record. They are like pre defined templates eg ALIAS is template of A record.
4) Update the domain's FORWARD / URL record so that foobaryfoobs.com points to www.foobaryfoobs.com
For a nooby, please explain why this is necessary.
It is necessary because www.foobaryfoobs.com and foobaryfoobs.com are different in a same way like images.google.com and news.google differs. www is nothing special it is just a subdomain. If you dont do this, user can't use your site from foobaryfoobs.com but can access www.foobaryfoobs.com.
B.
1) Is this how it should be set up?
Yes, it is correct. But if you want to allow foobaryfoobs.com and www.foobaryfoobs.com, you have to do something like below table. You dont require *.foobaryfoobs.com record if your app doesn't use any subdomain except www. It is bad practice actually to add *.foobaryfoobs.com .
Type | Name | Content
---------------------------------------
ALIAS | foobaryfoobs.com | yoursite.herokuapp.com
CNAME | www.foobaryfoobs.com | yoursite.herokuapp.com
It’s important to make sure your DNS configuration agrees with the custom domains you’ve added to Heroku. In particular, if you have configured your DNS for *.example.com to point to example.herokuapp.com, be sure you also run heroku domains:add *.example.com. Otherwise, a malicious person could add baddomain.example.com to their Heroku app and receive traffic intended for your application.
Yes. Moreover you dont have to worry about this. If the malicious user can set subdomain at your domain then he capable to do much destruction :P. Actually, malicious user can't access your DNS management tool so you're safe.
In your registrars host records you want to set the # to the redirect to the www.foobaryfoobs.com and the www record to the CNAME of warm-chamber-1882.herokuapp.com, this is because Heroku may change the IP address associated with that hostname and if you have the ip in your registrar you would also have to update. Using a CNAME ties that url to the ip so when Heroku updates the ip your site is still up. As long as you don't touch your MX records your email will be fine.
To protect again *.foobaryfoobs.com issues they warn about you can also setup a host record for exactly that and make it a CNAME as well pointing at warm-chamber-1882.herokuapp.com.
As far as setting up the SSL you can look at this article, that should get you setup.
I can answer only some of this:
1) a) It updates some config stored on heroku's end related to your app. You can see that if you login to the heroku site and look at the config for your app.
b) dunno
c) this will let people type both "http://www.foobaryfoobs.com" and "http://foobaryfoobs.com" and for both of them to go to your app.
You can also do this with an A/AAAA record.. in my opinion the better way.
Check out my answer in this thread
Heroku EU region how to setup custom domain name?

Why is my heroku hosted bluehost domain www.rememberlenny.com different from rememberlenny.com

I have uploaded a rails application to Heroku. I have a domain hosted with bluehost. I have assigned the domain to bluehost and set the CNAME properties of the WWW record point to the herokuapps URL. I have the # A-record pointing to the bluehost shared Host ip address. Because I dont have a HerokuApps unique IP address, I havn't assigned an A-Record.
Currently when I go to the www.rememberlenny.com and the rememberlenny.com, they are displaying two seperate sites.
Today I changed the domain record of the CNAME on WWW to the heroku app. The non-WWW domain propagates to the old shared hosting location. I want both the www.rememberlenny.com and rememberlenny.com to show the same place.
Do I wait for the DNS change to propogate, or is there some setting that I am not changing the host records?
Your ttl is set to 14400 or 4 hours. It's always a good idea to set that very low BEFORE you need to change the DNS records.
Here is info on heroku dns settings: https://devcenter.heroku.com/articles/custom-domains
Heroku does NOT support A records on the bare domains name (without the www), so you need to change that to a url redirect or forward record and remove the A record on the bare domain.
I have tried configuring Heroku custom domains using Bluehost and Hostmonster in the past (currently use Hostmonster), and in their CPanel DNS Zone Editor the TTL (time to live) for any DNS changes is 14400, or 4 hours.
I tried to lower this setting, and they don't permit it. There's no way around it - you have to accept their default TTL of 4 hours. I'm really hoping my change works, because the idea of a 4 hour trial and error cycle sounds dreadful.
Anyway, hope this answer sheds some light on what has been a hellish process - trying to get Heroku to play nicely with Hostmonster's DNS settings.
D.

Rails, Heroku and Subdomains. Is my special case scenario feasible?

Here is my scenario:
I have an application that will have to support multiple clients. Each client will be given a subdomain for there service. We will also have a brochure website that doesn't have the application, its just a website about the product and how potential clients can setup an account with us.
Given:
www.mycoolsite.com would point to a brochure app on Heroku.
client1.mycoolsite.com, client2.mycoolsite.com and client3.mycoolsite.com would all point to the same SaaS application that could tell the difference between each request and I should be able to handle so they only see their date (i.e. setting a global client_id or something like that)
How do I go about doing this? I haven't done a lot with DNS so I'm pretty clueless about where to start with this.
Thanks.
No sweat. We do that now, at Heroku. We happen to use Godaddy for the domain registrar, but any DNS control panel will let you do the same thing.
The other explanations I read here are a little general, here are the specifics...
The explanation at heroku is very good, at : http://docs.heroku.com/custom-domains
(there's even a very good screencast shows step by step)
the key thing is if your ROOT domain (mycoolsite.com) is at Heroku you want to create THREE "A" records, because they do some fault-tolerant crossover magic. So you'd have an A record for
75.101.163.44
75.101.145.87
174.129.212.2
Now for each subdomain you create a CNAME record
www -> proxy.heroku.com
client1 -> proxy.heroku.com
client2 -> proxy.heroku.com
client3 -> proxy.heroku.com
NOW on the HEROKu side, you have two apps right? The 'brochure app' and the saas app.
Login, and for each app go to Resources -> Addon -> Get More Addons ->Custom Domains (free)
for the brochure app, add ONE domain: www.mycoolsite.com
for the saas app, add each of the clients, eg:
client1.mycoolsite.com
client2.mycoolsite.com
client3.mycoolsite.com
That's it. works like a champ. Have fun.
What you're trying to do is very feasible, and quite easy to do.
You're going to need a combination of A and CNAME records. Simply put, A records map host names to IP addresses, and CNAME records act as aliases for A records.
Let's assume that your SaaS app is hosted at 10.0.0.1 and your Heroku app is at 192.168.0.1, and that you want www.mycoolsite.com and mycoolsite.com to point at the same IP.
(Note: I've never hosted anything at Heroku, so configuring DNS that may be slightly different)
First thing you'll need is an A record for the domain itself. (I've used BIND Zone File Syntax here - hopefully your DNS provider has a much simpler administration system.)
mycoolsite.com. A 192.168.0.1 ; heroku
www CNAME mycoolsite.com ; also heroku
These two records tell us that mycoolsite.com should point at Heroku's IP address, and that www.mycoolsite.com is an alternate name for mycoolsite.com, which will also resolve to Heroku's IP address.
Now, let's set up the DNS for your SaaS site. You could set up an A record for each sub-domain, but if you move servers, you'll have a lot of IP addresses to update. The simplest option is to configure one A record, then point your app's sub-domains at it:
sassapp A 10.0.0.1 ; saas app server canonical name
client1 CNAME sassapp ; alias
client2 CNAME sassapp ; alias
client3 CNAME sassapp ; alias
You can then add as many CNAMEs as you need.
I don't see this being an issue. Rails has had support for subdomains like that in the past with help from gems like subdomain_fu. In Rails 3, subdomain support is actually built in and covered by Ryan Bates http://railscasts.com/episodes/221-subdomains-in-rails-3. Take a look at that screencast for a good direction of where to start.
I believe you'll need the custom domains add-on for Heroku http://docs.heroku.com/custom-domains.
This won't be a problem. For DNS set up an A record for mycoolsite.com pointing to the server where you want your application. Set up an A record for www.mycoolsite.com that is configured for heroku. Now you will also want to redirect traffic that comes in on mycoolsite.com without www and redirect to www.mycoolsite.com, this will keep your top-level domain serving up your brochure app. Once requests are getting to your application you can follow the tutorial that raidfive linked to that will help you through handling subdomains inside of your application.

Resources