0

My website (http://www.carshare.hk) has a problem with the naked domain. When it is served with the root domain, the server cannot hit anything. But I have followed through the guides from heroku about adding domains already.

When I typed heroku domains -a my-app, the root domain shows it is added. I know that I cannot use an A record with heroku. But I am not too sure how to redirect the root to www with Cloudns.net.

Any captain here?

Andrew Schulman
  • 8,561
  • 21
  • 31
  • 47
  • It's called an apex but how do you host dns for that domain? – Mike Mar 08 '15 at 11:33
  • The only way out is either to use a DNS service provider which supports 'CNAME-like functionality at the zone apex using a custom record type' (quoted from Heroku's site) or use URL forwarding as suggested by Esa below. Make sure CNAME flattening doesn't impact your other services though, such as email. – Daniel t. Mar 08 '15 at 13:43

2 Answers2

1

It seems that you already got this one working by using free simple redirection service from a 3rd party, since now we can get

GET / HTTP/1.1
Host: example.com

HTTP/1.1 301 Moved Permanently
Location: http://www.example.com/

However, creating this kind of simple redirect could easily be handled on any server running any httpd. Now you are relying on a 3rd party free service provider. How can you guarantee this service:

  • Will stay alive?
  • Won't, under any circumstances, forward your traffic to somewhere else?
  • Doesn't use this trust for any other purposes? By having an A record of your domain the service prociver can do almost anything with it: the control is not limited in HTTP traffic.

I'd suggest using any server you can manage by yourself and adding a NameVirtualHost, e.g. in Apache:

<VirtualHost *:80>
    ServerName example.com
    Redirect / http://www.example.com/
</VirtualHost>

I'd also suggest using generalized domain instead of your actual domain name to prevent giving away information about your configuration.

Esa Jokinen
  • 43,252
  • 2
  • 75
  • 122
-1

To do this just create an Alias, points to www.carshare.hk and let the host blank.

  • 1
    you cannot `CNAME` at the zone level which is what an *alias* sounds like it will create – chicks Dec 16 '15 at 20:56
  • Chicks (nice alias), Andrew was asking for the problem in Cloudns.net. I answered with the procedure in Cloudns.net, not in the server. By the way, I had the same problem and I don't have anymore. – Carlos Roweder Nass Feb 09 '16 at 12:58