

Ask YC: How do you enable users to use their own domains with your application? - shabda

For example, wordpress.com, blogger.com allow you to use your own domains with their application. This proceed as,<p>1. You create a blog at whatever.blogspot.com<p>2. You point a CNAME from your domain  say mycname.mysite.com to ghs.google.com<p>3. The dns changes propgate and you can access your blog at mycname.mysite.com<p>So what can I do to enable users to use their own domains, with my application, which will be on a subdomain on mysite?<p>[Edit: Layout]
======
ovi256
Can't you use a wildcard? I think you can. Just announce *.youdomain.com ->
your.IP. Then, you can just use a custom rewrite rule to transform
subdomain.domain.tld into www.domain.tld/sub/subdomain or something similar.
From there, you're home free to do everything in your preferred language and
framework.

------
brett
Tell users to CNAME their domain to your own and then render pages based on
the incoming HTTP "Host" header?

I feel like you've answered the bulk of your question. Are you looking for
something more specific?

~~~
shabda
Thanks a ton. I wanted to confirm "then render pages based on the incoming
HTTP "Host" header" part. A few questions for you,

1\. So if DNS CNAME cname.theirsite.com is pointed to myserver.mysite.com, the
Http requests will come to myserver.com.mysite.com, with Http['host'] as
cname.theirsite.com.

2\. Where can I read more about how DNS in general and CNAMES in particlular
work?

~~~
brett
1\. Yes. cname.theirsite.com resolves to myserver.com.mysite.com which in turn
resolves to an IP address. Browsers will send requests to your server at that
IP along with cname.theirsite.com in "Host" header.

2\. I'm not totally sure. I would start with wikipedia:
<http://en.wikipedia.org/wiki/Domain_Name_System>

Users will likely ask for help, so you'll probably want to familiarize
yourself with the UIs for major DNS providers, especially GoDaddy.

Another gotcha is that CNAMEs can be a little funky for root domains. So
something.com will be harder (or impossible) for people to CNAME than
foo.something.com depending on their provider. I've been told that CNAMEing
the root domain means that all records (like MX) get automatically aliased as
well, but I haven't found that to be uniformly true. My guess is that it
depends on the DNS software.

------
reidman
Not sure that this is going to help anyone, but since we're on the topic of
DNS stuff, I thought I'd throw this out there for anyone who wants control of
their domains without having to run a DNS server:

I've been immensely happy with EveryDNS ( <http://everydns.net> ) since I
started using it. It's a free, web-based DNS service. You just point your
nameservers at their site and you can then manage all of your domains with
their interface -- no need to screw around with nameservers anymore.

I now have nearly 500 records for almost 100 domains on there. While the web
interface is pretty janky, I can only remember the service itself going down
once over the past year.

~~~
Poleris
The only problem with EveryDNS is lack of API or way of making large-scale
changes.

~~~
bprater
I use something similar, dnsmadeeasy.com. API, fail-over, redundancy, crappy
UI. I can't ask for more from a DNS host!

------
pmjordan
Whichever way you do it, you'll need to hook into your domain's master DNS
servers. Maybe your DNS server operator has an API (or you need to find one
who does), or you run your own DNS server and do it yourself. Operating DNS
servers isn't rocket science, and reloading/refreshing the name database is
generally a pretty well-supported feature.

If you're letting users point their subdomain at their own IP address or
server, you'll probably want to set a relatively low TTL - most dynamic DNS
services use 15 minutes - although you should be aware that this will increase
the load on your DNS server. If it's just a matter of creating subdomains that
point at _your_ servers and dispatching on virtual hosts, you can safely use
more usual TTL values.

