modif cors to allow /

This commit is contained in:
2026-02-27 06:56:27 +01:00
parent 506201dd73
commit 7f42fa0b02
2 changed files with 5 additions and 3 deletions

View File

@@ -335,7 +335,7 @@ apxtri.runexpress = async (tribesdns, conf) => {
return callback(null, true); return callback(null, true);
} }
if (regorigin.test(origin) || allowedOrigins.includes(origin)) { if (regorigin.test(origin) || allowedOrigins.includes(origin) || allowedOrigins.includes(origin.replace(/\/$/, ''))) {
return callback(null, true); return callback(null, true);
} else { } else {
console.log( console.log(
@@ -353,7 +353,7 @@ apxtri.runexpress = async (tribesdns, conf) => {
app.use((req, res, next) => { app.use((req, res, next) => {
const origin = req.headers.origin; const origin = req.headers.origin;
if (origin && !regorigin.test(origin) && !allowedOrigins.includes(origin)) { if (origin && !regorigin.test(origin) && !allowedOrigins.includes(origin) && !allowedOrigins.includes(origin.replace(/\/$/, ''))) {
console.log(`CORS blocked: ${origin}`); console.log(`CORS blocked: ${origin}`);
return res.status(403).json({ error: 'CORS not allowed', origin }); return res.status(403).json({ error: 'CORS not allowed', origin });
} }

View File

@@ -22,7 +22,9 @@
"xlang", "xlang",
"xtribe", "xtribe",
"xapp", "xapp",
"xuuid" "xuuid",
"xprofils",
"xtrkversion"
], ],
"appset": { "appset": {
"trust proxy": true "trust proxy": true