From 5321c0a00f1b0dd3f3e0ce33d51819fc89bf5df5 Mon Sep 17 00:00:00 2001 From: Didier Krux Date: Mon, 22 May 2023 13:10:02 +0100 Subject: [PATCH] fix api headers --- next.config.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/next.config.js b/next.config.js index 8efb45bc1..9b01dd8c7 100644 --- a/next.config.js +++ b/next.config.js @@ -97,6 +97,20 @@ const config = { }, async headers() { return [ + { + // mathching all API routes + 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', + }, + ], + }, { source: '/:path*', headers,