fix(backend): Add manual OPTIONS handler for legacy clients
Some checks are pending
Test / backend-test (push) Waiting to run
Test / frontend-test (push) Waiting to run

This commit is contained in:
fullsizemalt 2026-01-06 23:53:32 -08:00
parent ed7b78be32
commit f97e8ea1d0

View file

@ -39,6 +39,15 @@ server.register(cors, {
credentials: true,
methods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS']
});
// Manual OPTIONS handler as fallback
server.options('/*', async (request, reply) => {
reply.header('Access-Control-Allow-Origin', request.headers.origin || '*');
reply.header('Access-Control-Allow-Credentials', 'true');
reply.header('Access-Control-Allow-Methods', 'GET,POST,PUT,PATCH,DELETE,OPTIONS');
reply.header('Access-Control-Allow-Headers', 'Content-Type, Authorization');
return reply.send();
});
server.register(prismaPlugin);
server.register(jwt, {
secret: process.env.JWT_SECRET || 'supersecret'