Skip to content

Commit

Permalink
temp: fix frame ancestor error by removing csp
Browse files Browse the repository at this point in the history
@todo: instead of removing csp, we should make it less lax/configurable for embedding in iframes such as makeswift
  • Loading branch information
matthewvolk committed Jun 21, 2024
1 parent 059a7bf commit eaaf591
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ const createNextIntlPlugin = require('next-intl/plugin');
const withMakeswift = createWithMakeswift();
const withNextIntl = createNextIntlPlugin();

const cspHeader = `
base-uri 'self';
form-action 'self';
frame-ancestors 'none';
`;
// @todo relax csp for makeswift embedding
// const cspHeader = `
// base-uri 'self';
// form-action 'self';
// frame-ancestors 'none';
// `;

/** @type {import('next').NextConfig} */
const nextConfig = {
Expand All @@ -26,19 +27,19 @@ const nextConfig = {
},
// default URL generation in BigCommerce uses trailing slash
trailingSlash: process.env.TRAILING_SLASH !== 'false',
async headers() {
return [
{
source: '/(.*)',
headers: [
{
key: 'Content-Security-Policy',
value: cspHeader.replace(/\n/g, ''),
},
],
},
];
},
// async headers() {
// return [
// {
// source: '/(.*)',
// headers: [
// {
// key: 'Content-Security-Policy',
// value: cspHeader.replace(/\n/g, ''),
// },
// ],
// },
// ];
// },
};

module.exports = withMakeswift(withNextIntl(nextConfig));

0 comments on commit eaaf591

Please sign in to comment.