Skip to content

Commit

Permalink
dhabilitando cors para qualquer origem
Browse files Browse the repository at this point in the history
  • Loading branch information
jesielviana committed Jan 16, 2024
1 parent 7cde2f3 commit 0caf15b
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,21 @@ const nextConfig = {
async headers() {
return [
{
// matching all API routes
source: '/api/*',
// Routes this applies to
source: '/api/(.*)',
// Headers
headers: [
{ key: 'Access-Control-Allow-Credentials', value: 'true' },
{ key: 'Access-Control-Allow-Origin', value: '*' }, // replace this your actual origin
{ key: 'Access-Control-Allow-Methods', value: 'GET,DELETE,PATCH,POST,PUT' },
// Allow for specific domains to have access or * for all
{
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',
key: 'Access-Control-Allow-Origin',
value: '*',
// DOES NOT WORK
// value: process.env.ALLOWED_ORIGIN,
},
// Allows for specific methods accepted
{
key: 'Access-Control-Allow-Methods',
value: 'GET, POST, PUT, DELETE, OPTIONS',
},
],
},
Expand Down

0 comments on commit 0caf15b

Please sign in to comment.