- risolto problema della non attesa della PWA durante la chiamata a Node.js.

- risolto problema dell'ambiente in Locale HTTPS certificato installato aggiornato.
This commit is contained in:
Surya Paolo
2025-03-13 12:05:16 +01:00
parent 65b29a6eee
commit 0017f04e45
12 changed files with 370 additions and 223 deletions

View File

@@ -754,19 +754,6 @@ connectToDatabase(connectionUrl, options)
return { key: privateKey, cert: certificate };
}
} else if (process.env.HTTPS_LOCALHOST === "true") {
try {
return {
key: fs.readFileSync(process.env.PATH_CERT_KEY, 'utf8'),
cert: fs.readFileSync(process.env.PATH_SERVER_CRT, 'utf8'),
ciphers: 'ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES256-SHA384',
honorCipherOrder: true,
secureProtocol: 'TLSv1_2_method'
};
} catch (error) {
console.error('Errore durante la lettura dei file di certificazione, error:', error.message);
throw error;
}
}
// Caso di default non specificato, potrebbe essere necessario aggiungere una gestione degli errori qui
}
@@ -810,7 +797,7 @@ connectToDatabase(connectionUrl, options)
let allowedOrigins = null;
if (!isProduction) {
allowedOrigins = 'http://localhost:3000';
allowedOrigins = 'https://localhost:3000';
} else {
allowedOrigins = domains.flatMap(domain => [
@@ -819,11 +806,12 @@ connectToDatabase(connectionUrl, options)
`https://test.${domain.hostname}`,
`https://testapi.${domain.hostname}`,
`https://freeplanet.app:3000`,
`https://freeplanet.app:3001`,
`http://${domain.hostname}`,
`http://api.${domain.hostname}`,
`http://test.${domain.hostname}`,
`http://testapi.${domain.hostname}`
]);
]);
}
@@ -834,7 +822,8 @@ connectToDatabase(connectionUrl, options)
try {
// Validazione dell'input
if (!origin || typeof origin !== 'string' || !/^https?:\/\/[^\s/$.?#].[^\s]*$/.test(origin)) {
console.error('❌ Origine non valida', origin);
if (origin)
console.error('❌ Origine non valida', origin);
}
// Logging per il debug