diff --git a/src/reverseproxy.js b/src/reverseproxy.js index 38a68a6a8..33091ec52 100644 --- a/src/reverseproxy.js +++ b/src/reverseproxy.js @@ -429,10 +429,9 @@ async function ensureCertificate(vhost, domain, auditSource) { return { bundle: getFallbackCertificatePathSync(domain), renewed: false }; } -async function writeDashboardNginxConfig(bundle, configFileName, vhost) { - assert.strictEqual(typeof bundle, 'object'); - assert.strictEqual(typeof configFileName, 'string'); +async function writeDashboardNginxConfig(vhost, bundle) { assert.strictEqual(typeof vhost, 'string'); + assert.strictEqual(typeof bundle, 'object'); const data = { sourceDir: path.resolve(__dirname, '..'), @@ -446,7 +445,7 @@ async function writeDashboardNginxConfig(bundle, configFileName, vhost) { ocsp: await isOcspEnabled(bundle.certFilePath) }; const nginxConf = ejs.render(NGINX_APPCONFIG_EJS, data); - const nginxConfigFilename = path.join(paths.NGINX_APPCONFIG_DIR, configFileName); + const nginxConfigFilename = path.join(paths.NGINX_APPCONFIG_DIR, `${vhost}.conf`); if (!safe.fs.writeFileSync(nginxConfigFilename, nginxConf)) throw new BoxError(BoxError.FS_ERROR, safe.error); @@ -459,12 +458,10 @@ async function writeDashboardConfig(domain) { debug(`writeDashboardConfig: writing admin config for ${domain}`); const domainObject = await domains.get(domain); - const dashboardFqdn = dns.fqdn(constants.DASHBOARD_LOCATION, domainObject); - const bundle = await getCertificatePath(dashboardFqdn, domainObject.domain); - await writeDashboardNginxConfig(bundle, `${dashboardFqdn}.conf`, dashboardFqdn); + await writeDashboardNginxConfig(dashboardFqdn, bundle); } async function writeAppNginxConfig(app, fqdn, bundle) { @@ -675,7 +672,7 @@ async function renewCerts(options, auditSource, progressCallback) { // reconfigure since the cert changed if (appDomain.type === 'webadmin' || appDomain.type === 'webadmin+mail') { - await writeDashboardNginxConfig(bundle, `${settings.dashboardFqdn()}.conf`, settings.dashboardFqdn()); + await writeDashboardNginxConfig(settings.dashboardFqdn(), bundle); } else if (appDomain.type === apps.SUBDOMAIN_TYPE_PRIMARY) { await writeAppNginxConfig(appDomain.app, appDomain.fqdn, bundle); } else if (appDomain.type === apps.SUBDOMAIN_TYPE_REDIRECT) {