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.
Related
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.
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.
My Rails app works with Heroku and if I set my CNAME at my domain register Afrihost to www.domain and without the www it works fine for an hour. Then it kills the app without the www domain infront and I have to log in and change the dns again.
Afrihosts states, because of a certain law it can't point a cname to both with a www and without a www in-front. Is that true for all domain registers?
What alternatives are there as I want to point to both with and without the www in-front.
Thanks in advance.
Erin
I liked the fix I went with. I just added a url redirect from mywebsite.com to www.mywebsite.com. So on type you just choose 'Redirect' and leave the host part blank. Then type in the url of your website 'http://www.mywebsite.com/' in the 'Data' section. Worked for me.
CNAMES cannot be used on naked domains (e.g. yourapp.com), only subdomains (e.g www.yourapp.com).
For the naked domains, you need an A record, or something like DNSimple's ALIAS.
I found the answer https://devcenter.heroku.com/articles/avoiding-naked-domains-dns-arecords
I must use an A-Record.
Thanks
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
I've read Heroku's documentation:
http://devcenter.heroku.com/articles/custom-domains#wildcard_domains
They say to add:
To use with a custom domain, configure your DNS registrar to point *.yourdomain.com at yourapp.heroku[app].com.
In GoDaddy, you can't do:
*.yourdomain.com
in the name field. I've heard you can get around that by doing:
**
However, I tried that, but it's not working.
When I run this in console:
host anysub.yourdomain.com
I get:
Host anysub.yourdomain.com not found: 3(NXDOMAIN)
What could be the problem? I'm guessing the wildcard isn't set up in GoDaddy correctly?
(FYI: I swapped out yourdomain.com for my actual domain.)
Go to GoDaddy's DNS Manager, the first table on top should say A(Host), click the button under that first table that says Quick Add. In the first text field, enter an asterisk (*), in the second one, the IP address to redirect to (the same one you have for the # record on top). Click "Save Zone File" on top-right and confirm.
This creates a catch-all record to anysub.yourdomain.com.
Good luck.
I just tried it today and it seems that it's now possible to create wildcard cnames in GoDaddy.
GoDaddy > ... > DNS Manager -> Zone File Editor (Edit Zone)
Then under CNAME (Alias) panel > Quick Add
Host: *
Points to: yourapp.herokuapp.com
Or
Host: *.dev.herokuapp.com
Points to: yourapp.herokuapp.com
Then click on "Save Zone File" and wait a few minutes.
I remember getting this "Host not found 3(NXDOMAIN)" error myself not so long ago. Not anymore.
Any subdomain other than those listed explicitly in either A or CNAME are redirected as expected.
I had this challenge recently and I tried all of the above, but none of them worked for me. After days of surfing I found a solution.
If your app is hosted on heroku, you'd usually not have a static IP Address and so the wild card A record will not work as the IP keeps changing
GoDaddy > ... > Manage DNS > ADD record
Record Type is
CNAME
Host
*
Points to your heroku app
Note: you can't do this if you already have a wild card A record
go to ->goddady cpanel->select subdomain
Create a Subdomain
Subdomain add *
*
in domain
yourdomain.com
then enter create