diff --git a/src/apps.js b/src/apps.js index 69d8e13cc..a2d12361f 100644 --- a/src/apps.js +++ b/src/apps.js @@ -127,7 +127,6 @@ function validateHostname(location, domain, hostname) { assert.strictEqual(typeof domain, 'string'); const RESERVED_LOCATIONS = [ - config.adminLocation(), // FIXME: this shouldn't be here constants.API_LOCATION, constants.SMTP_LOCATION, constants.IMAP_LOCATION, @@ -135,6 +134,8 @@ function validateHostname(location, domain, hostname) { ]; if (RESERVED_LOCATIONS.indexOf(location) !== -1) return new AppsError(AppsError.BAD_FIELD, location + ' is reserved'); + if (hostname === config.adminFqdn()) return new AppsError(AppsError.BAD_FIELD, location + ' is reserved'); + // workaround https://github.com/oncletom/tld.js/issues/73 var tmp = hostname.replace('_', '-'); if (!tld.isValid(tmp)) return new AppsError(AppsError.BAD_FIELD, 'Hostname is not a valid domain name');