heroku rails app domain only working without www - ruby-on-rails

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

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.

Heroku ACM not working

I have a RoR app hosted in Heroku and I'm trying to set my custom domains. In fact, I want three custom domains: www.myapp.org, www.myapp.eu and www.myapp.es.
I have configured my DNS to point to the DNS targets provided by Heroku. I have the .eu and .es domains registered in www.piensasolutions.com and the .org in cloudns.
The redirection works perfectly fine but I have discovered that ACM is unable to generate certificates for my .es domain. The other 2 work perfectly fine (.org and .eu) but the .es is failing. Even though is configured exactly the same as the .eu one, as they are both registered in the same site.
I have tried to see the status of the certifications using heroku certs:auto and it says "Failing" for the "www.myapp.es"
It was a matter of time. Seems like certificating a local domain like .es is slower for the Heroku ACM. After nearly 20h everything is set up. Sorry for the time waste.

Site serving blank page after setting up forwarding from GoDaddy to Heroku (frame error?)

I have a domain through GoDaddy, and set it up to forward to my app on heroku (I was using forwarding with masking). This was working great, until I tried to add an A-record to enable forwarding from a naked URL. Now, when I go to my site, I get a blank page, and the error message:
Refused to display 'myherokuurl' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.
And the source code in dev tools is a frame src. I have no idea why. I deleted the extra A-record that seems to have caused this problem almost 48 hours ago (so I don't think DNS propagation is an issue anymore). This is how I currently have everything set up in the DNS zone in GoDaddy:
My A records:
My CNAME:
And I have forwarding with masking set up to go to my heroku URL.
I also notice that when I run host www.mysiteurl.com, I get www.mysiteurl.com is an alias for mysiteurl.com.
Isn't that supposed to be www.mysiteurl.com is an alias for http://myherokuapp.herokuapp.com?
I'm using Cedar 14 stack on Heroku, and have read that A-records don't play nicely with that, so I'm tempted to delete my A-record and just go with what I have in the CNAME, but I'm afraid I'll further screw things up.
I really don't know what to do and am at the end of my rope with this. If anyone could offer any piece of advice or guidance, I'd really appreciate it.
So it looks like the key issue to solving this was to remove the "forwarding with masking" option from GoDaddy--that's what broke everything, despite their telling me that the DNS was just updating and I needed to wait 48 hours -_-
My only issue now is just that the heroku url appears in my browser when I land on my site!
You just have to enable IFrame support, by adding this to your application.rb file:
class Application < Rails::Application
# ...
# ...
# insert here the following code:
config.action_dispatch.default_headers = {
'X-Frame-Options' => 'ALLOWALL'
}
end
Then push to Heroku, the error message and blank page should disappear to show your page normally.

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: custom domains

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.

Resources