From 06c9f9d87b27db1ef413c9d5a230c2c92133ed45 Mon Sep 17 00:00:00 2001 From: Tom Hall <31667058+tmhall99@users.noreply.github.com> Date: Tue, 15 Apr 2025 19:35:45 -0400 Subject: [PATCH] fix: add CORS headers to API routes --- next.config.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/next.config.js b/next.config.js index 03f1095..a971794 100644 --- a/next.config.js +++ b/next.config.js @@ -20,6 +20,19 @@ const nextConfig = { }, ], }, + async headers() { + return [ + { + source: '/api/:path*', + headers: [ + { key: 'Access-Control-Allow-Credentials', value: 'true' }, + { key: 'Access-Control-Allow-Origin', value: '*' }, + { key: 'Access-Control-Allow-Methods', value: 'GET,OPTIONS,PATCH,DELETE,POST,PUT' }, + { key: 'Access-Control-Allow-Headers', value: 'X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version' }, + ] + } + ] + }, }; module.exports = nextConfig;