small prod changes
All checks were successful
Release Build / build-docker (push) Successful in 43s
Release Build / build-android-and-release (push) Successful in 2m11s

This commit is contained in:
Rene Kievits
2025-12-24 16:20:44 +01:00
parent ac225b5b41
commit e1bf8f2032
9 changed files with 93 additions and 41 deletions

View File

@@ -17,10 +17,20 @@ const allowedOrigins = [
'capacitor://localhost',
'https://10.0.2.2:5173',
'http://localhost:5173'
];
].filter(Boolean).map(uri => uri.replace(/\/$/, ''));
await fastify.register(cors, {
origin: allowedOrigins,
origin: (origin, cb) => {
if (!origin) return cb(null, true);
if (allowedOrigins.includes(origin)) {
return cb(null, true);
}
console.log(`CORS BLOCKED: Browser sent "${origin}". Allowed list:`, allowedOrigins);
cb(new Error("Not allowed by CORS"));
},
methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],
credentials: true
});