diff --git a/src/reverseproxy.js b/src/reverseproxy.js index 2d80f1b68..01d4b9ae4 100644 --- a/src/reverseproxy.js +++ b/src/reverseproxy.js @@ -448,13 +448,13 @@ async function ensureCertificate(fqdn, domainObject, options, auditSource) { await safe(eventlog.add(renewal ? eventlog.ACTION_CERTIFICATE_RENEWAL : eventlog.ACTION_CERTIFICATE_NEW, auditSource, { domain: fqdn, errorMessage: renewError?.message || '' })); } -async function writeDashboardNginxConfig(fqdn, certificatePath) { - assert.strictEqual(typeof fqdn, 'string'); +async function writeDashboardNginxConfig(vhost, certificatePath) { + assert.strictEqual(typeof vhost, 'string'); assert.strictEqual(typeof certificatePath, 'object'); const data = { sourceDir: path.resolve(__dirname, '..'), - vhost: fqdn, + vhost, hasIPv6: sysinfo.hasIPv6(), endpoint: 'dashboard', certFilePath: certificatePath.certFilePath, @@ -464,7 +464,7 @@ async function writeDashboardNginxConfig(fqdn, certificatePath) { ocsp: await isOcspEnabled(certificatePath.certFilePath) }; const nginxConf = ejs.render(NGINX_APPCONFIG_EJS, data); - const nginxConfigFilename = path.join(paths.NGINX_APPCONFIG_DIR, `${fqdn}.conf`); + const nginxConfigFilename = path.join(paths.NGINX_APPCONFIG_DIR, `${vhost}.conf`); if (!safe.fs.writeFileSync(nginxConfigFilename, nginxConf)) throw new BoxError(BoxError.FS_ERROR, safe.error); } @@ -481,15 +481,15 @@ async function writeDashboardConfig(domainObject) { await reload(); } -async function writeAppNginxConfig(app, fqdn, type, certificatePath) { +async function writeAppNginxConfig(app, vhost, type, certificatePath) { assert.strictEqual(typeof app, 'object'); - assert.strictEqual(typeof fqdn, 'string'); + assert.strictEqual(typeof vhost, 'string'); assert.strictEqual(typeof type, 'string'); assert.strictEqual(typeof certificatePath, 'object'); const data = { sourceDir: path.resolve(__dirname, '..'), - vhost: fqdn, + vhost, hasIPv6: sysinfo.hasIPv6(), ip: null, port: null, @@ -535,7 +535,7 @@ async function writeAppNginxConfig(app, fqdn, type, certificatePath) { data.port = app.manifest.httpPort; } else if (type === apps.LOCATION_TYPE_SECONDARY) { data.ip = app.containerIp; - const secondaryDomain = app.secondaryDomains.find(sd => sd.fqdn === fqdn); + const secondaryDomain = app.secondaryDomains.find(sd => sd.fqdn === vhost); data.port = app.manifest.httpPorts[secondaryDomain.environmentVariable].containerPort; } } else if (type === apps.LOCATION_TYPE_REDIRECT) { @@ -545,8 +545,8 @@ async function writeAppNginxConfig(app, fqdn, type, certificatePath) { } const nginxConf = ejs.render(NGINX_APPCONFIG_EJS, data); - const filename = path.join(paths.NGINX_APPCONFIG_DIR, `${app.id}-${fqdn.replace('*', '_')}.conf`); - debug(`writeAppNginxConfig: writing config for "${fqdn}" to ${filename} with options ${JSON.stringify(data)}`); + const filename = path.join(paths.NGINX_APPCONFIG_DIR, `${app.id}-${vhost.replace('*', '_')}.conf`); + debug(`writeAppNginxConfig: writing config for "${vhost}" to ${filename} with options ${JSON.stringify(data)}`); if (!safe.fs.writeFileSync(filename, nginxConf)) { debug(`Error creating nginx config for "${app.fqdn}" : ${safe.error.message}`); throw new BoxError(BoxError.FS_ERROR, safe.error);