Skip to content

Commit e932b16

Browse files
committed
feat: cors settings
1 parent b85d6d1 commit e932b16

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

next.config.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,31 @@ const nextConfig = {
3636
},
3737
],
3838
},
39+
{
40+
source: '/api/:path*', // API 경로에 대해 CORS 헤더 추가
41+
headers: [
42+
{key: 'Access-Control-Allow-Credentials', value: 'true'},
43+
{key: 'Access-Control-Allow-Origin', value: '*'},
44+
{
45+
key: 'Access-Control-Allow-Methods',
46+
value: 'GET,OPTIONS,PATCH,DELETE,POST,PUT',
47+
},
48+
{
49+
key: 'Access-Control-Allow-Headers',
50+
value:
51+
'X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version',
52+
},
53+
],
54+
},
55+
];
56+
},
57+
58+
async rewrites() {
59+
return [
60+
{
61+
source: '/api/github-stats/:path*',
62+
destination: 'https://stats.hyo.dev/api/github-stats/:path*',
63+
},
3964
];
4065
},
4166
};

0 commit comments

Comments
 (0)