Skip to content

Commit ba7af37

Browse files
authored
relax CORS for /graphql API route (graphql#1940)
* relax CORS for /graphql API route * format
1 parent ccfd300 commit ba7af37

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

next.config.js

+21
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,27 @@ export default withLess(
6262
NEXT_PUBLIC_GA_ID:
6363
process.env.NODE_ENV === "production" ? "UA-44373548-16" : "",
6464
},
65+
headers: async () => {
66+
return [
67+
{
68+
source: "/graphql",
69+
headers: [
70+
{
71+
key: "Access-Control-Allow-Origin",
72+
value: "*",
73+
},
74+
{
75+
key: "Access-Control-Allow-Methods",
76+
value: "GET, POST, OPTIONS",
77+
},
78+
{
79+
key: "Access-Control-Allow-Headers",
80+
value: "Content-Type",
81+
},
82+
],
83+
},
84+
]
85+
},
6586
trailingSlash: true,
6687
// Only for local development, skip 200 statusCode due following error:
6788
//

0 commit comments

Comments
 (0)