3
votes

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:

Is this a better way?

5

5 Answers

3
votes

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.

1
votes

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.

0
votes

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.

0
votes

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.

-1
votes

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/