Heroku: custom domains - ruby-on-rails

I had set up my custom domain on Heroku and it was working. Then I decided I wanted to delete that app but use the same domain on another app. I tried switching it over, but I got error messages saying it was already in use.
Therefore, I decided to start from scratch. I went to Godaddy, reset the nameservers (changing them to other nameservers and then back to Zerigo/Heroku) so that they were now pointing fresh at Zerigo.
I then added the domain to this new app but when i run the following in the terminal to check that it's been added properly.
host www.mydomain.com
I get this error
www.mydomain.com has address 67.63.50.58
Host www.mydomain.com not found: 3(NXDOMAIN)
Host www.mydomain.com not found: 3(NXDOMAIN)
This addresss 67.63.50.58 is not the heroku/zerigo address.
However, I'm quite sure that I know how to set up a custom domain. For example, i tested another custom domain on this same app (a custom domain that I hadn't assigned anywhere else previously) and it's now working fine.
Anyone know how I can reuse this custom domain i.e. totally reset it. Or can you explain what that error message means?

If you get a message that the domain is already in use when you add the domain to a new app on Heroku that would suggest to me that when you deleted the application previously then for whatever reason Heroku did not delete the previous custom domains - you shouldn't have to change any DNS settings if the domain was already pointing at Heroku. I would contact support in this instance and tell them the scenario, they should be able to fix it.

Related

How to get SSL working on Rails app with Heroku?

I am trying to get SSL working on my Rails app that I am deploying with Heroku.
I have used the automated certificate management from Heroku and followed the directions, but when I visit my site I still see a “Not Secure” label in the URL bar. I am trying to figure out how to address this.
My site is at http://give.toacause.com/. When I use inspect in the chrome browser and go to Security, I read that the certificate is missing. However, when I click “view certificate”, I see a notice that “This certificate is valid.”
What step am I missing here?
It appears as though the CNAME record for give.toacause.com is mysterious-bastion-66058.herokuapp.com
You need to use *.herokudns.com.
heroku domains will output something like
Domain Name DNS Record Type DNS Target
give.toacause.com CNAME give.toacause.com.herokudns.com
You need to set the CNAME to the value of the DNS target field. After you do, make sure you flush your DNS cache so you can resolve and check it again, or use one of the many HTTPS checkers on the internet.

Setting up domain from domain.com with Heroku

I have several domains with domain.com , and it used to be if I want to set up a Heroku app with a domain bought at domain.com, all I have to do is point the cname to [name-of-heroku-app].herokuapp.com . And add the domain in Heroku.
But now, if I add a domain at Heroku, the DNS target will be [domain-name].herokudns.com . My older apps on heroku with a custom domain however have a DNS target of [name-of-heroku-app].herokuapp.com .
Am I doing something wrong? Can't seem to get the domain to work properly. Any help would be appreciated.
Nonetheless. Set the CNAME to [name-of-heroku-app].herokuapp.com and not [domain-name].herokudns.com.
I would wait a few hours as it depends on many circumstances how fast the change happens.
[domain-name].herokudns.com should be used, when you want to add SSL:
The DNS Target can be different from the Heroku Domain and different for each custom domain. For instance, if you add Heroku SSL on your application, your DNS target will be .herokudns.com, instead of .herokuapp.com.
Source

Redirecting my Heroku app to a custom domain on BigRock

I have added my domain to heroku using heroku domains:add.
Now when I run heroku domains in my terminal, I get
=== sampleapp Domain Names
sampleapp.herokuapp.com
sampleapp.me
www.sampleapp.me
I'm unable to configure BigRock's DNS to point to the Heroku-supplied DNS Target (which is sampleapp.herokuapp.com).
There's a domain forwarding option in BigRock, but when I use it, it shows my Heroku app in an iframe.
In the DNS management panel, I see A records, CNAME records etc., but I have no understanding of what they mean. I have, however, added a www cname with the value shown in the image below.
Can someone please tell me how I should go about doing this? Thank you.
I had to remove my A records for WWW to get it working.
For naked domain, CNAME is not recommended.

Setting up a custom domain with Heroku and namecheap

I've followed all the instructions on https://devcenter.heroku.com/articles/custom-domains to get my custom domain set up, and it still isn't working.
On Heroku, I have the following domains:
myapp.herokuapp.com
example.com
www.example.com
And on Namecheap, I have the following settings:
HOST NAME | IP ADDRESS/URL | RECORD TYPE
# http://example.com URL Redirect
www myapp.herokuapp.com. CNAME(Alias)
When I run: "host www.example.com" in my terminal, I expect to get "www.example.com is an alias for myapp.herokuapp.com". Instead, I get:
"www.example.com is an alias for myapp.heroku.com"
I can't figure out why it is pointing to myapp.heroku.com, because I have only specified myapp.herokuapps.com.
Does anybody know why this is happening?
Update note: Heroku and Namecheap change their interfaces every so often. This answer may have outdated screenshots, but it will be updated over time. See these updates below.
I've just done this myself so I thought I'd chime in as the answer doesn't illustrate how to get both www.example.org and example.org working. Heroku also changed its admin interface a bit.
Namecheap
First, login to Namecheap.
Go to Domain List and click "Manage" for the domain you're configuring.
Set both record types to CNAME (Alias) and enter your <name>.herokuapp.com in both url-boxes (# and www).
(PS: If they're not there, click the "Add new record" and add them there.)
Next, head over to Heroku
Login and choose your project from the list. For this example, we're choosing the "Lakka" project.
On the project page, click Settings
Scroll down and find the Add domain section
Enter your example.org and click Save.
Click the button again, and input your www.example.org and click Save.
That's it, You're done! Now when you enter example.org or www.example.org in your browser, both will show your Heroku project.
In this example, http://lakka.herokuapp.com would be accessible (after DNSes update) also on http://lakkatracker.com and http://www.lakkatracker.com.
(If you want to redirect traffic from www.example.org to example.org, which is a good practise, you can use the record type "URL (Redirect)" for the www host name)
It can take some time before your DNSs recognize the changes. You can try using a proxy for testing, like Anonymouse, if your changes aren't reflected immediately.
1) Go To Namecheap, and go to the domain you want to manage.
2) On the left sidebar, click "All Record Hosts", NOT any of the other jazz other tutorials tell you. No DNS pointing changes are necessary. It's easier to use alias.
3) Once you do, you'll see a line starting with "www" as a CNAME (Alias) option. Fill this in as your heroku app's domain name example.herokuapp.com
That's it for namecheap.
4) Then at heroku settings, under "domains", enter your purchased domain name you wish to be displayed.
That's it!
It's as easy as letting heroku and namecheap know about both domain aliases.
Credits to this blog:
http://blog.romansanchez.me/2013/06/08/point-namecheap-domain-to-heroku/
Update:
Apparently, heroku will only allow sites with www. prepended. To have a true root domain without www. will take some extra ninja hacking.
Namecheap updated its interface. New screenshots to supplement other good answers:
If you want all the traffic to point to http://example.com then do this:
and set both example.com and www.example.com in Heroku settings.
Then test everything by using http://anonymouse.org
Set up a namecheap config that looks like this:
And a heroku config that looks like this:
And you're good to go!
Depending on your application, it may be a result of not using an SSL certificate. If you are trying to use an SNI SSL on the free dyno it is not going to work. In my case, I upgraded to hobby dyno and it immediately worked via the ACM.
Here are 2 possibilities,
You had previously pointed the DNS records to myapp.heroku.com and the changes haven't propagated yet
This could be an artifact of the change Heroku made move apps from the heroku.com domain to the herokuapp.com domain, but I'm unsure of how this could happen or why it would happen for you; records for my apps all point directly to herokuapp.com, but I'm not using NameCheap.
You could try registering a different (free) domain with an entity like .tk to see if this is specific to NameCheap.
I linked a namecheap domain to my Heroku app today and it is now a bit different, so here is what I did.
Add the domain (purchased on namecheap) to your Heroku app like www.example.com. The 'www' is important. Copy the generated xxx.herokudns.com link.
Now go to your domain settings on namecheap. Click on Advanced DNS.
Add the following two records:
Type: CNAME Record, Host: www, Value: the copied URL from step 1.
Type: URL Redirect Record, Host: #, Value: http://www.example.com
Save and maybe you have to wait for up to 30 minutes.
I couldn't get both www.example.com and example.com to work, so one of the workarounds I found was to set the CNAME and # to www., and then on the Domain tab, set "Redirect Doman" from example.com to www.example.com.

heroku rails app domain only working without www

I moved an app from my existing ISP to heroku 2 days ago.
It seems like it wasn't working until I realized I had put railslinks.com instead if www.railslinks.com in the heroku web control panel interface.
So when I actually tried http://railslinks.com instead of http://www.railslinks.com it worked
So (today 1 hr ago) I added www.railslinks.com in the heroku control panel.
I made NO changes to my DNS settings with Network Solutions (which show all my various domains with the www prefix).
So far though, I'm not yet able to connect to http://www.railslinks.com
Is there a dns-like delay in getting my heroku change propogated or am I missing something.
Note: 'myapp' is not the actual name, just my placeholder in the document.
DNS Settings at Network Solutions:
Heroku Settings (I've put both of them there for now, tried www alone didn't help):
Found it, have to use my "zergio" dns editing tool:
Provided you have a CNAME entry for www.myapp.com pointing at either proxy.heroku.com or myappname.herokuapp.coun then it should work.
Adding domains is almost instant on Heroku, this sounds more like a DNS issue but without knowing your real domain makes it tough to diagnose.
For me this has worked out for www.reactjs.co (just add www. in the heroku app admin panel):
herokuapp fix - click here for the screenshot

Resources