Skip to content

Commit

Permalink
Add ADMIN_URL to allowed origins in site (#122)
Browse files Browse the repository at this point in the history
When making a CORS request to a Next API route from inside the block
preview, the request's origin is the Admin URL. This is probably due to
the same-origin policy. We need to set the `Access-Control-Allow-Origin`
header to allow such requests.
  • Loading branch information
johnnyomair authored Jan 29, 2024
1 parent f3cc237 commit 4901365
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions site/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ const nextConfig = {
.replace(/\s{2,}/g, " ")
.trim(),
},
{
key: 'Access-Control-Allow-Origin',
value: process.env.ADMIN_URL,
}
],
},
],
Expand Down

0 comments on commit 4901365

Please sign in to comment.