tls: fix wildcard alias cert file names

also, do not provision redirect certs. redirect domains can never
hit the server anyway.
This commit is contained in:
Girish Ramakrishnan
2023-02-25 14:49:41 +01:00
parent dbbe93955c
commit abacc60181

View File

@@ -314,9 +314,11 @@ async function setupTlsAddon(app) {
const certificateDir = `${paths.PLATFORM_DATA_DIR}/tls/${app.id}`;
const contents = [];
for (const location of getAppLocationsSync(app)) {
if (location.type === apps.LOCATION_TYPE_REDIRECT) continue;
const certificate = await getCertificate(location);
contents.push({ filename: `${location.fqdn}.cert`, data: certificate.cert });
contents.push({ filename: `${location.fqdn}.key`, data: certificate.key });
contents.push({ filename: `${location.fqdn.replace('*', '_')}.cert`, data: certificate.cert });
contents.push({ filename: `${location.fqdn.replace('*', '_')}.key`, data: certificate.key });
if (location.type === apps.LOCATION_TYPE_PRIMARY) { // backward compat
contents.push({ filename: 'tls_cert.pem', data: certificate.cert });