diff --git a/src/apps.js b/src/apps.js index 7cbb7145e..b0920d28c 100644 --- a/src/apps.js +++ b/src/apps.js @@ -103,7 +103,7 @@ AppsError.BAD_CERTIFICATE = 'Invalid certificate'; // https://en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_host_names // We are validating the validity of the location-fqdn as host name function validateHostname(location, fqdn) { - var RESERVED_LOCATIONS = [ constants.ADMIN_LOCATION, constants.API_LOCATION, constants.SMTP_LOCATION, constants.IMAP_LOCATION ]; + var RESERVED_LOCATIONS = [ constants.ADMIN_LOCATION, constants.API_LOCATION, constants.SMTP_LOCATION, constants.IMAP_LOCATION, constants.MAIL_LOCATION ]; if (RESERVED_LOCATIONS.indexOf(location) !== -1) return new Error(location + ' is reserved'); diff --git a/src/cloudron.js b/src/cloudron.js index d03465d75..cb795fe7b 100644 --- a/src/cloudron.js +++ b/src/cloudron.js @@ -451,7 +451,7 @@ function addDnsRecords() { // DMARC requires special setup if report email id is in different domain var dmarcRecord = { subdomain: '_dmarc', type: 'TXT', values: [ '"v=DMARC1; p=none; pct=100; rua=mailto:' + DMARC_REPORT_EMAIL + '; ruf=' + DMARC_REPORT_EMAIL + '"' ] }; - var mxRecord = { subdomain: '', type: 'MX', values: [ '10 ' + config.adminFqdn() + '.' ] }; + var mxRecord = { subdomain: '', type: 'MX', values: [ '10 ' + config.mailFqdn() + '.' ] }; var records = [ ]; if (config.isCustomDomain()) { diff --git a/src/config.js b/src/config.js index 426ca3c0f..83b05a35d 100644 --- a/src/config.js +++ b/src/config.js @@ -28,6 +28,7 @@ exports = module.exports = { internalAdminOrigin: internalAdminOrigin, sysadminOrigin: sysadminOrigin, // caas routes adminFqdn: adminFqdn, + mailFqdn: mailFqdn, appFqdn: appFqdn, zoneName: zoneName, adminEmail: adminEmail, @@ -167,6 +168,10 @@ function adminFqdn() { return appFqdn(constants.ADMIN_LOCATION); } +function mailFqdn() { + return appFqdn(constants.MAIL_LOCATION); +} + function adminOrigin() { return 'https://' + appFqdn(constants.ADMIN_LOCATION); } diff --git a/src/constants.js b/src/constants.js index adb61cc96..96a5f1a0c 100644 --- a/src/constants.js +++ b/src/constants.js @@ -6,6 +6,7 @@ exports = module.exports = { API_LOCATION: 'api', // this is unused but reserved for future use (#403) SMTP_LOCATION: 'smtp', IMAP_LOCATION: 'imap', + MAIL_LOCATION: 'my', // not a typo! should be same as admin location until we figure out certificates ADMIN_NAME: 'Settings',