diff --git a/src/cloudron.js b/src/cloudron.js index 746c9906d..e51f39688 100644 --- a/src/cloudron.js +++ b/src/cloudron.js @@ -78,6 +78,7 @@ function onActivated(callback) { // 1. mail bounces can now be sent to the cloudron owner // 2. the restore code path can run without sudo (since mail/ is non-root) async.series([ + reverseProxy.removeDefaultConfig, // remove IP based nginx config once user is created platform.start, cron.startJobs, function checkBackupConfiguration(callback) { @@ -125,15 +126,13 @@ function runStartupTasks() { // check activation state and start the platform users.isActivated(function (error, activated) { if (error) return debug(error); + // configure nginx to be reachable by IP when not activated. for the moment, the IP based redirect exists even after domain is setup // just in case user forgot or some network error happenned in the middle (then browser refresh takes you to activation page) // we remove the config as a simple security measure to not expose IP <-> domain if (!activated) { - debug('runStartupTasks: generating IP based redirection config'); - reverseProxy.writeDefaultConfig(NOOP_CALLBACK); - } else { - debug('runStartupTasks: removing IP based redirection config'); - reverseProxy.removeDefaultConfig(NOOP_CALLBACK); + debug('runStartupTasks: not activated. generating IP based redirection config'); + return reverseProxy.writeDefaultConfig(NOOP_CALLBACK); } onActivated(NOOP_CALLBACK);