remove IP nginx configuration that redirects to dashboard after activation

fixes #728
This commit is contained in:
Girish Ramakrishnan
2020-08-13 14:00:55 -07:00
parent 9d2284add7
commit ba29889f54
3 changed files with 37 additions and 20 deletions
+10 -4
View File
@@ -112,9 +112,6 @@ function runStartupTasks() {
// stop all the systemd tasks
platform.stopAllTasks(NOOP_CALLBACK);
// configure nginx to be reachable by IP
reverseProxy.writeDefaultConfig(NOOP_CALLBACK);
// this configures collectd to collect backup storage metrics if filesystem is used. This is also triggerd when the settings change with the rest api
settings.getBackupConfig(function (error, backupConfig) {
if (error) return debug('runStartupTasks: failed to get backup config.', error);
@@ -127,7 +124,16 @@ function runStartupTasks() {
// check activation state and start the platform
users.isActivated(function (error, activated) {
if (error) return debug(error);
if (!activated) return debug('initialize: not activated yet'); // not activated
// 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);
}
onActivated(NOOP_CALLBACK);
});