Skip to content

Commit

Permalink
feat: cors settings
Browse files Browse the repository at this point in the history
  • Loading branch information
hyochan committed Nov 2, 2024
1 parent b85d6d1 commit e932b16
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,31 @@ const nextConfig = {
},
],
},
{
source: '/api/:path*', // API 경로에 대해 CORS 헤더 추가
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',
},
],
},
];
},

async rewrites() {
return [
{
source: '/api/github-stats/:path*',
destination: 'https://stats.hyo.dev/api/github-stats/:path*',
},
];
},
};
Expand Down

0 comments on commit e932b16

Please sign in to comment.