Skip to content

Commit

Permalink
[templates/nextjs] fixed plugin of cors header (#1637)
Browse files Browse the repository at this point in the history
  • Loading branch information
sc-ruslanmatkovskyi authored Oct 26, 2023
1 parent e817e8c commit ddd4137
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Our versioning strategy is as follows:
* `[templates/nextjs]` Enable client-only BYOC component imports. Client-only components can be imported through src/byoc/index.client.ts. Hybrid (server render with client hydration) components can be imported through src/byoc/index.hybrid.ts. BYOC scaffold logic is also moved from nextjs-sxa addon into base template ([#1628](https://github.com/Sitecore/jss/pull/1628)[#1636](https://github.com/Sitecore/jss/pull/1636))
* `[templates/nextjs]` Import SitecoreForm component into sample nextjs app ([#1628](https://github.com/Sitecore/jss/pull/1628))
* `[sitecore-jss-nextjs]` (Vercel/Sitecore) Deployment Protection Bypass support for editing integration. ([#1634](https://github.com/Sitecore/jss/pull/1634))
* `[templates/nextjs]` Fix custom headers. Now in cors-header plugin extends custom headers from next.config.js file. ([#1637](https://github.com/Sitecore/jss/pull/1637))

### 🐛 Bug Fixes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ const corsHeaderPlugin = (nextConfig = {}) => {
}
return Object.assign({}, nextConfig, {
async headers() {
const extendHeaders = typeof nextConfig.headers === "function" ? await nextConfig.headers() : [];
return [
...await extendHeaders,
{
source: '/_next/:path*',
headers: [{ key: 'Access-Control-Allow-Origin', value: config.sitecoreApiHost }],
Expand Down

0 comments on commit ddd4137

Please sign in to comment.