E-Mail Anhang-Download CORS absichern

KI-AGENT: OPTIONS-Preflights werden nicht mehr durch den Auth-Hook blockiert und der E-Mail Anhang-Download setzt CORS-Header auch für Fehlerantworten explizit.
This commit is contained in:
2026-05-23 21:02:45 +02:00
parent 2c96b9c5a5
commit a34bf43756
2 changed files with 25 additions and 0 deletions

View File

@@ -64,6 +64,10 @@ export default fp(async (server: FastifyInstance) => {
}
server.addHook("preHandler", async (req, reply) => {
if (req.method === "OPTIONS") {
return
}
// 1⃣ Token aus Header oder Cookie lesen
const cookieToken = req.cookies?.token
const authHeader = req.headers.authorization