Basic functionality in place, need improved errors and logged in redirect
This commit is contained in:
33
server/utils/domains.js
Normal file
33
server/utils/domains.js
Normal file
@@ -0,0 +1,33 @@
|
||||
// @flow
|
||||
import parseDomain from 'parse-domain';
|
||||
|
||||
export function stripSubdomain(hostname) {
|
||||
const parsed = parseDomain(hostname);
|
||||
if (parsed.tld) return `${parsed.domain}.${parsed.tld}`;
|
||||
return parsed.domain;
|
||||
}
|
||||
|
||||
export const RESERVED_SUBDOMAINS = [
|
||||
'admin',
|
||||
'api',
|
||||
'beta',
|
||||
'blog',
|
||||
'cdn',
|
||||
'community',
|
||||
'developer',
|
||||
'forum',
|
||||
'help',
|
||||
'imap',
|
||||
'localhost',
|
||||
'mail',
|
||||
'ns1',
|
||||
'ns2',
|
||||
'ns3',
|
||||
'ns4',
|
||||
'smtp',
|
||||
'support',
|
||||
'status',
|
||||
'static',
|
||||
'test',
|
||||
'www',
|
||||
];
|
||||
Reference in New Issue
Block a user