我正在开发一个SaaS(软件即服务)网络应用程序,而我正在使用子域名来管理不同的帐户。
我应该阻止用户使用哪些子域。
我目前拥有的是...管理员,管理员,博客,支持和帮助。我记得在Quora上看过一个关于它的问题,但我再也找不到了。
答案 0 :(得分:3)
感谢您的建议。我已经创建了一个用于阻止大量子域的Rubygem,可以在这里找到 - https://github.com/deanperry/saas_deny_subdomains
只需添加deny_subdomains :subdomain
(:subdomain)作为字段,它就会阻止/拒绝大量的子域列表。
答案 1 :(得分:2)
命名视图:
答案 2 :(得分:2)
除了提到的那些:
可能还想保留自己的名字和任何变体。
编辑:只是一个想法,也许在顶部,但你也可以考虑保留像i.example.com(“我”为内部)的东西然后你有一个整体* .i.example.com的名称空间供内部使用。
答案 3 :(得分: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