I have my domain name example.com from domain registrar BigRock, which also provides me the DNS management panel.
My application is hosted at Heroku at example.herokuapp.com.
Domain Settings at Heroku:
bash-3.2$ heroku domains
=== MyApp Domain Names
*.example.com
example.herokuapp.com
example.com
www.example.com
In my DNS Management panel, I have 0 A records, 1 MX records for Hotmail and 1 CNAME record for www.example.com.
I know about the problem with Naked domains and A-records with Heroku.
I have gone through these:
1. StackOverflow ques - How to setup DNS for an apex domain (no www) pointing to a Heroku app?
2. Heroku DevCenter - Custom domains - set up root domain
3. Heroku DevCenter - Apex Domains
The above links and many others point towards 2 solutions:
Using ALIAS or ANAME records by DNSimple/ DNS Made Easy
If your DNS provider does not support such a record-type, and you are unable to switch to one that does, you will need to use subdomain redirection to send root domain requests to your app on Heroku.
Since, I couldn't find such records on BigRock DNS Management Console. There were only these records - "A, AAAA, MX, CNAME, TXT, SRV and SOA".
Accordingly, I have setup "Domain Forwarding" for my domain. But, it only gave me option to provide "Designation URL where you wish to forward requests for www.example.com and example.com".
Now, If I do
bash-3.2$ host example.com
example.com has address 173.194.16.11
example.com mail is handled by 15 888379351a9a.pamx1.hotmail.com.
and
bash-3.2$ host www.example.com
www.example.com is an alias for example.herokuapp.com.
This does solve the naked domain problem. But other subdomains like xyz.example.com are still not redirected to www.example.com, because
there is no mention to redirect all subdomains i.e "*" to any other designation in the "Domain Forwarding" section on BigRock DNS provider.
So, my question is how can I solve this problem of redirecting sub-domains?
Another Query Related to SSL -
Here in the Heroku Devcenter - subdomain redirection, it says that
"However, be aware that, using this method, a secure request to the root domain, e.g., https://example.com, will result in an error or warning being displayed to the user."
Is there any way of fixing the above issue, or do I have to switch to DNSimple or DNS Made Easy to use the ALIAS or ANAME records services they provide?
UPDATE:
On further digging, I found this SO ques - Rails Manually redirecting from Naked Domain, which suggests using:
Rack_rewrite
Refraction gem
Is this a better way?
Once you setup a domain forward in BigRock DNS panel, you will see two A records like example.com => 173.193.106.11 and www.example.com => 173.193.106.11. The same way if you create wildcard dns A record, it will redirect for all the domains. i.e *.example.com => 173.193.106.11
I am not sure if the IP is same in your case because Bigrock might be using multiple servers to offer this service.
Linode do not offer naked domain ANAME records either. A solution I have found is to add a www.site.com CNAME record for the Heroku app as normal. Then point the naked domain/catch-all A record to the following IP address:
174.129.25.170
This is a free naked domain redirect service offered by wwizer. It will take your naked domain, and simply redirect it to a www. equivalent:
site.com => www.site.com
Hope this helps.
Try adding your domain name with www in the 'Destination' of Domain Forwarding Panel.
Later, remove the A record for www. Hence, there will only be 2 A records
i.e for naked domain and wildcard (*)
Then add a CNAME record for www pointing to the HerokuApp value.
Do let us know if you are facing any issues.
You have to do Domain Forwarding of your site from naked domain to www sub domain. This features available next to Manage DNS feature. Once the dialog open, just enter your www subdomain(www.example.com). After 6 to 8 hours(sometime it take 1 day), It will automatically add an A record for your naked domain(example.com) points to ip 173.193.106.14.
For e.g. kanhaiyakumawat.com and kanhaiyakumawat.herokuapp.com
Here are the steps
Add records in your heroku account for
www.kanhaiyakumawat.com to kanhaiyakumawat.herokuapp.com
kanhaiyakumawat.com to kanhaiyakumawat.herokuapp.com
*.kanhaiyakumawat.com to kanhaiyakumawat.herokuapp.com
So now with this heroku side setup is done. Lets move to bigrock 'DNS Management' section. Click 'Manage DNS'.
Add CNAME Records
www.kanhaiyakumawat.com to kanhaiyakumawat.herokuapp.com
*.kanhaiyakumawat.com to kanhaiyakumawat.herokuapp.com
MOST IMPORTANT: Setting up Naked Domain or root domain Setup
Now this is most trickiest part. Just leave the 'hostname' text box
empty and select 2nd radio button in Values.
Put here your heroku dns value e.g. kanhaiyakumawat.herokuapp.com
Same steps are available here:
http://kanhaiyakumawat.com/blog/heroku-and-bigrock-dns-setup/
Related
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.
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.
I'm in trouble.
I have this website which runs on heroku with a custom domain from another provider. I made the connection between the 2 with the correct DNS.
It seemed to work on my browser but it didn't work on other computers, and after clearing my cache it didn't work on mines either. When they visit the site it shows the domain providers website.
At first i thought it had something to do with ssl, cause i got errors saying your connection is not private. Then i changed config_force_ssl to false:
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
config.force_ssl = false
It seems that the A records in my domain providers DNS settings link to IP addresses and Heroku doesn't support ip addresses. Or it could still be something ssl related.
Here is my domain providers DNS:
ftp.example.io - CNAME - example.io
www.example.io - CNAME - example-example.herokuapp.com
example.io - A - 91.184.0.100
localhost.example.io - A - 91.184.0.100
webmail.example.io - A - 91.184.0.100
*.example.io - A - 91.184.0.100
mail.example.io - A - 91.184.0.94
Here is the domain i added on heroku:
Domain name: example.io
DNS Target: example-example.herokuapp.com
I have no idea anymore about what it could be. Any help would be appreciated
You should create a CNAME record on the DNS provider : https://devcenter.heroku.com/articles/custom-domains
Heroku not supports DNS. But you can add custom domains and subdomains, and from your domain hosting settings, redirecting to Heroku app. Here is little shot from Youtube
#for domain
$ heroku domains:add www.example.com`
Adding www.example.com to example... done
>
#for subdomain
$ heroku domains:add blog.example.com`
Adding blog.example.com to example... done
Configure heroku domain name to www.example.io.
Oké i fixed the issue. For the people that are struggling with it, here is how i did it:
Step 1
Make a Cloudflare account, and add the bought domain to cloudflare and
transfer the DNS settings'
Step 2
Add your domain to your heroku panel. On the heroku site, log in, go
to 'settings' press 'add custom domain'
- Add both your domain 'www.example.com' and your root domain 'example.com'
Step 3
If you haven't changed your nameservers on your initial domain
provider to point to the cloudflare nameservers, please do so now. You
can find the cloudflare nameservers which are assigned to you on your
cloudflare panel under 'DNS' -> 'cloudflare name servers'
Step 4
Go to 'DNS' on your cloudflare account and remove all records (A,
CNAME, ALIAS,TXT etc..).
Now add a CNAME record. The name should be your site 'www.example.com' (with www) and it should point to your heroku app example-example.herokuapp.com
Step 5
Create a Google Business account. And follow along with the
verification steps given by Google.
Step 6
Log in at admin.google.com and go to 'domains'. If you can't see
'domains' click on 'more elements'. Now click on 'change redirect' and
make your root domain 'example.com' redirect to 'www.example.com'.
Step 7
Go to your cloudflare panel and go to 'DNS', now add 4 'A' Records.
- All 4 of the 'A' records should have the name of your root domain 'example.com' and they should point to 216.239.32.21,
216.239.34.21, 216.239.36.21, 216.239.38.21, which are the ip
addresses given by Google to make the redirects work.
Side note
On cloudflare, the 'A' record statuses need to be set to 'DNS Only'
and the 'CNAME' record statuses to 'DNS and HTTP proxy(CDN)'
Step 8
On your rails app go to production.rb and make sure
config.action_mailer.default_url_options = { host:
'https://example-example.herokuapp.com' } is set to
config.action_mailer.default_url_options = { host:
'example-example.herokuapp.com' } so simply remove the 'https://'.
And also config.force_ssl should be false
After you have done that make sure you upload the result to heroku.
Step 9
At cloudflare go to 'crypto' and make sure SSL is set to 'Flexible',
if not please change it now, it might take a few moments before the changes are completed by cloudflare.
CONGRATULATIONS !!!!!!!!!!!!!
At this point your site should be up and running and working for both
your root domain aswell as for your full domain.
EXTRA
ONLY IF YOU WANT BUSINESS EMAILS BY GMAIL (eg. info#example.com)
On cloudflare go to 'DNS' and add 5 'MX' Records.
example.com(your root domain) - point to aspmx.l.google.com with priority 1
example.com(your root domain) - point to alt1.aspmx.l.google.com with priority 5
example.com(your root domain) - point to alt2.aspmx.l.google.com with priority 5
example.com(your root domain) - point to alt3.aspmx.l.google.com with priority 10
example.com(your root domain) - point to alt4.aspmx.l.google.com with priority 10
Note: The TTL should be set to '1 hour' for all 'MX' records.
Now go out there and be the best version of yourself!!
I've got a domain (and hosting account) with iPage.
I'd like to point this domain example.com and www.example.com to my heroku app - which is currently available at example.herokuapp.com.
I've set up a CNAME (Alias) as follows:
host: www
points to: example.herokuapp.com
I've gone through Heroku's documentation for custom domain names; however, I've been unable to make it work.
What do I need to do differently?
The reason you are not able to access your site at www.example.com even after setting up the DNS correctly is you have not updated your application setting inside Heroku. You need to provide Heroku with the web address want to host your site, this you can do inside your Application Settings page.
Heroku does not support apex domain so you might want to setup a redirect from example.com to www.example.com, I don't see why you would want to run your site on two web address. But you really want to run your site on two addresses you can try zerigo dns addon on heroku. Zerigo dns can also help you setup the redirect.
https://devcenter.heroku.com/articles/apex-domains
Just like it says in the title, I followed heroku's instructions and added 'myapp.com' and 'www.myapp.com' as domains for my heroku app.
The former works correctly but the latter does not. Any ideas? EDIT: When I point my browser to 'www.myapp.com', I get an error from Comcast, my ISP, saying that the URL was not found.
You can do this 2 different ways:
First way:
In your heroku custom domains add www.myapp.com.
In your DNS point the www CNAME to proxy.heroku.com
Second way:
Have you subdomain redirect to myapp.com
You followed the part about DNS setup and setting up a CNAME for www.myapp.com? If so and you just set it up, it can take as many as 48 hours for all the DNS servers to update.
If that's not the case, make sure you have your CNAME record set up correctly with the domain's host so it knows about the www subdomain.