From 94cc04440ac94f296516a4ccd0940954e58b1215 Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Fri, 17 Jan 2025 13:30:13 +0100 Subject: [PATCH 1/2] relax CORS for /graphql API route --- next.config.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/next.config.js b/next.config.js index e6a84b9dd9..13ddd223b5 100644 --- a/next.config.js +++ b/next.config.js @@ -62,6 +62,27 @@ export default withLess( NEXT_PUBLIC_GA_ID: process.env.NODE_ENV === "production" ? "UA-44373548-16" : "", }, + headers: async () => { + return [ + { + source: "/graphql", + headers: [ + { + key: "Access-Control-Allow-Origin", + value: "*" + }, + { + key: "Access-Control-Allow-Methods", + value: "GET, POST, OPTIONS" + }, + { + key: "Access-Control-Allow-Headers", + value: "Content-Type" + }, + ] + } + ] + }, trailingSlash: true, // Only for local development, skip 200 statusCode due following error: // From 6c497b205ae8a07875b73af722075eb8f34c7222 Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Fri, 17 Jan 2025 13:35:00 +0100 Subject: [PATCH 2/2] format --- next.config.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/next.config.js b/next.config.js index 13ddd223b5..bfd990f81e 100644 --- a/next.config.js +++ b/next.config.js @@ -69,18 +69,18 @@ export default withLess( headers: [ { key: "Access-Control-Allow-Origin", - value: "*" + value: "*", }, { key: "Access-Control-Allow-Methods", - value: "GET, POST, OPTIONS" + value: "GET, POST, OPTIONS", }, { key: "Access-Control-Allow-Headers", - value: "Content-Type" + value: "Content-Type", }, - ] - } + ], + }, ] }, trailingSlash: true,