2012-08-08 54 views
4

我正在开发SaaS(软件即服务)Web应用程序,并且我将子域用于单独的帐户。要阻止哪些SaaS子域名

哪些子域应该阻止用户使用。

我现在拥有的是......管理员,管理员,博客,支持和帮助。我记得在Quora上看到一个关于它的问题,但我再也找不到它了。

回答

3

感谢您的建议。我做了一个Rubygem阻止它可以在这里找到子域的负载 - https://github.com/deanperry/saas_deny_subdomains

只需添加deny_subdomains :subdomain(:子域)是该领域,它会阻止/拒绝子域的一个巨大的列表。

2

要命名视图:

  • WWW
  • 帮助
  • 支持
  • 管理
  • API
  • assets0-X
2

除了提到的那些:

  • 测试
  • 阶段/分期
  • 开发/开发
  • 状态
  • 邮件
  • 的webmail
  • FTP
  • 饲料
  • SSL /安全
  • d EMO
  • 混帐/ SVN
  • 文件/文件

可能还需要保留自己的名字和任何变化。只是一个想法,也许在顶部,但你也可以考虑保留一些像i.example.com(“我”是内部的),那么你有一个*的整个名称空间。 i.example.com供内部使用。

2

这是我的PHP版本。我添加了一些我+ +在线程+迪恩佩里的建议。 我能够通过使用一些正则表达式来覆盖很多场景。

/** 
* Checks if the subdomain is good. e.g. forbidden names are: ssl, secure, test, tester etc. 
* @see http://stackoverflow.com/questions/11868191/which-saas-subdomains-to-block 
* @see https://github.com/deanperry/saas_deny_subdomains/blob/master/lib/saas_deny_subdomains/subdomains.rb 
* @return boolean 
*/ 
public function isSubdomainAvailable($subdomain) { 
    $banned_subdomains_csv = 'admin, login, administrator, blog, dashboard, admindashboard, images?, img, files?, videos?, help, support, cname, test, cache, mystore, biz, investors? 
    api\d*, js, static, s\d*,ftp, e?mail,webmail, webdisk, ns\d*, register, join, registration, pop\d?, beta\d*, stage, deploy, deployment,staging, testers?, https?, donate, payments, smtp, 
    ad, admanager, ads, adsense, adwords?, about, abuse, affiliate, affiliates, store, shop, clients?, code, community, forum?, discussions?, order, buy, cpanel, store, payment, 
    whm, dev, devel, developers?, development, docs?, whois, signup, gettingstarted, home, invoice, invoices, ios, ipad, iphone, logs?, my, status, networks?, 
    new, newsite, news, partner, partners, partnerpage, popular, wiki, redirect, random, public, resolver, sandbox, search, servers?, service,uploads?, validation, 
    signin, signup, sitemap, sitenews, sites, sms, sorry, ssl, staging,features, stats?, statistics?, graphs?, surveys?, talk, trac, git, svn, translate, validations, webmaster, 
    www\d*, feeds?, rss, asset[s\d]*, cp\d*, control panel, online, media, jobs?, secure, demo, i\d*, img\d*, css\d*, js\d*'; 

    $regex = $banned_subdomains_csv; 
    $regex = preg_replace('#\s#si', '', $regex); // rm new lines, spaces etc 
    $regex = preg_replace("#,+#si", '|', $regex); // more than one comma 
    $regex = trim($regex, ','); // remove any leading/trailing commas 
    $regex = '#^(?:' . $regex . ')$#si'; // let's create a nice regex. 

    $status = !preg_match($regex, $subdomain); // without main domain added 

    return $status; 
} 

Slavi

http://orbisius.com

+1

看起来不错,谢谢 – 2012-08-11 22:52:47