How to add domains to rails app in heroku - ruby-on-rails

I deployed my app to heroku and I added my godaddy domain to heroku with:
heroku domains:add www.domain.com
heroku domains:add domain.com
But when I type domain.com sometimes it doesnt work and it redirects me to godaddy. Only www.domain.com works fine. Is there anything I am missing in configuration?
This is my DNS records setting
Host
# 68.178.232.100
# 75.101.145.87
# 75.101.163.44
# 174.129.212.2
C-NAME(Alias)
www proxy.heroku.com

From what you've described your Heroku setup is fine. You need to make sure your GoDaddy DNS records are correctly pointing to Heroku, and specifically that your # record is set correctly so the root domain is handled by Heroku.
Update:
The Heroku IPs are:
75.101.163.44
75.101.145.87
174.129.212.2
68.178.232.100 is GoDaddy. Delete that record and you should be ok.

Check your DNS settings. If your DNS is set up properly you may just need to wait for it to propagate out to other nameservers, which can take up to a week. In all likelihood it will only take a day or two.

Related

Heroku Automated Certificate Management not working

I have a domain, example.com. It's running on hobby dynos in Heroku, so I figured I would enable Heroku Automated Certificate Management. I've set up Heroku like so:
=== example Custom Domains
Domain Name DNS Target
─────────────── ─────────────────────────────
example.com example.com.herokudns.com
www.example.com www.example.com.herokudns.com
My DNS settings are:
CNAME Record www example.com.herokudns.com.
URL Redirect Record # https://www.example.com Unmasked
However, neither the apex domain (example.com) or the www domain (www.example.com) work when I access the domain.
Help would be greatly appreciated.

Create a subdomain on Namecheap for a Heroku Rails app

I have a domain name registered on namecheap. Let's say it is mysite.com. I want this domain to be my personal site. I also want to create a subdomain like myapp.mysite.com for a Rails app on Heroku.
I have tried to configure one in the DNS section of the Namecheap dashboard but I'm new with theses things. I'm using a CNAME type, # for host and automatic for TTL.
I have also added myapp.mysite.com as a custom domain in my Heroku dashboard.
Am I doing this right? Please explain it in detail so I can learn more about DNS.
EDIT:
I have changed my subdomain like this:
Type: CNAME
Host: myapp
Value: mysite.om
TTL: Automatic
Since the DNS has updated, I now get a 400 bad request error from Nginx.
Is it because of Heroku? Do I have to add some setting in Heroku?
I have found the solution for my question. So first of all, the correct configuration for the advanced DNS:
Type: CNAME
Host: myapp
Value: myapp.herokuapp.com (without the https protocol)
TTL: Automatic
After that, it takes a moment for the DNS to update the subdomain and make it available. During this time, I needed to add my subdomain to my Heroku configuration. It is possible via the dashboard of via terminal.
I did it via terminal with this command:
heroku domains:add myapp.mysite.com
After some time, it finally worked. However, having a custom domain or subdomain disable the default SSL from Heroku.
I mostly learn via this article:
https://devcenter.heroku.com/articles/custom-domains
The selected answer didn't work for me. But following the docs did.
Open terminal
heroku domains:add www.example.com
host www.example.com
Copy the url that looks like: whispering-willow-5678.herokudns.com
Note It will always be suffixed by .herokudns.com
Add a CNAME Record with the host (www, in my example).
Paste in the url you copied under Value (see screenshot below).
Click the check mark on Namecheap
Profit
Resources
Heroku Docs
Namecheap Docs

How to add multiple sub domains for a single app in heroku?

I am working on a Ruby On Rails app, it has multiple sub-domains for example: "admin.example.com", "user.example.com", "members.example.com" , so my question is how to deploy my app so that all these sub-domains work in staging mode in heroku. It is working fine on local host (using lvh.me to access subdomains). Right now I am not using any custom domain , I am using default domain name provided by Heroku.
Heroku has a free add-on that you can use to enable custom domain (and subdomain) names on their platform.
https://devcenter.heroku.com/articles/custom-domains
If you read that support article, you'll see that you need to follow these steps:
Verify your account on Heroku by adding a credit card number - they won't charge anything for this particular add-on.
Run this command at your command line to add the domain name example1.com to your account, so Heroku knows to route inbound traffic using that domain to your app:
$ heroku domains:add example1.com
Run this command to route all sub-domains of example1.com to your app:
$ heroku domains:add *.example1.com
The tricky part may be configuring your domain name to route traffic to Heroku in the first place. You'd do that by going to your domain name registrar, and creating a CNAME record in your DNS setup to route all traffic on *.example1.com to the original URL for your app on Heroku - example1.herokuapp.com.

Rails 4 Subdomain on production (Nginx + Passenger)

I've setup 1 apps for ex, example.com with devise auth on it. So when user signup, it will automatically create the subdomain for that user, for ex: user1.example.com where it will showing user profile, (as i follow here: https://railsapps.github.io/tutorial-rails-subdomains.html)
In my development env which is i use pow, everything work fine but not for production env. I can't access my user subdomain. It said something like "because the DNS lookup failed".
So my question, do I miss something to configure from the nginx site? or maybe from the dns?
Thanks in advance
For nginx essentially server_name *.example.org and same in dns settings for your domain - have the DNS entry as * as an A record.

Heroku and url forwarding issues without www

I have a working heroku app and have changed the url forwarding to my namecheap host. The full version of www.yadayada.com works perfectly. The problem is if I do yadayada.com it says
heroku | No such app
There is no app configured at that hostname.
Perhaps the app owner has renamed it, or you mistyped the URL.
In namecheap I have the # set to the Heroku url and the record type as cname alias. The same applies for the www. version.
Any suggestions?
Thanks!
Heroku recommends you forward your apex domain (yadayada.com) to a subdomain (like www) and then CNAME that subdomain to your Heroku app. This allows Heroku to maintain high availability for you, otherwise your apex points to an IP, which can change.
If you insist on the apex domain, see Heroku's DevCenter guides:
https://devcenter.heroku.com/articles/custom-domains
https://devcenter.heroku.com/articles/apex-domains
Finally, I think this could be solved by simply adding yadada.com to your domains with this:
$ heroku domains:add yadada.com -a yadayada

Resources