Skip to content

Commit 00bed86

Browse files
Next JS CORS Update
1 parent b651699 commit 00bed86

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

frontend/next.config.mjs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,21 @@ const nextConfig = {
99
images: {
1010
unoptimized: true,
1111
},
12+
async headers() {
13+
return [
14+
{
15+
// Matches all API routes
16+
source: "/:path*",
17+
headers: [
18+
{ key: "Access-Control-Allow-Credentials", value: "true" },
19+
// Replace with your allowed origin(s) or "*" for all
20+
{ key: "Access-Control-Allow-Origin", value: "*" },
21+
{ key: "Access-Control-Allow-Methods", value: "GET,DELETE,PATCH,POST,PUT" },
22+
{ 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" },
23+
]
24+
}
25+
]
26+
}
1227
};
1328

1429
export default nextConfig;

0 commit comments

Comments
 (0)