heroku如何添加这么多子域名?

时间:2015-01-21 15:38:59

标签: heroku amazon-web-services dns

所以我想弄清楚Heroku如何创建像http://social-login-in-rails.herokuapp.com这么多的子域名。我知道他们是AWS的经销商,所以每次有人创建应用程序时,他们只是添加一个route53条目吗?这可扩展吗?或者他们是否有某种系统,他们通过某种数据库查找路由所有子域?

1 个答案:

答案 0 :(得分:2)

一般来说,by default you can put 10,000 'subdomains' in a route53 zone('heroku.com')。这不是一个硬性限制,正如常见问题所示。

对于Heroku,他们不会将Route53用于他们的域名:

$ dig +nocmd heroku.com any +multiline +noall +answer
;; Truncated, retrying in TCP mode.
heroku.com.     449 IN SOA ns1.p19.dynect.net. admin.easydns.com.
heroku.com.     21599 IN NS ns3.p19.dynect.net.
heroku.com.     21599 IN NS ns4.p19.dynect.net.
heroku.com.     21599 IN NS ns2.p19.dynect.net.
heroku.com.     21599 IN NS ns1.p19.dynect.net.

(为清楚起见,上面的某些行被剪断了)

看来Heroku对所有子域使用通配符条目。第一个应用程序肯定存在,第二个应用程序肯定不存在(截至本文撰写时)。

$ dig +nocmd httpcats.herokuapp.com any +multiline +noall +answer 
httpcats.herokuapp.com. 299 IN CNAME us-east-1-a.route.herokuapp.com.
$ dig +nocmd cowcowcow.herokuapp.com any +multiline +noall +answer 
cowcowcow.herokuapp.com.    299 IN CNAME us-east-1-a.route.herokuapp.com.

点击cowcowcow.herokuapp.com的端点给出了404.这一切都有意义,因为Heroku讨论了如何使用“web router”,这是一个花哨/智能负载均衡器。