fix(storefront-chat): allow widget iframe embedding via CSP frame-ancestors
Shopify storefronts embed the chat widget cross-origin; Firefox blocks unless the response allows framing. Set Content-Security-Policy with frame-ancestors * for /storefront-chat/widget routes. Made-with: Cursor
This commit is contained in:
parent
0b384fcc59
commit
8e25dd88e8
@ -1,7 +1,26 @@
|
|||||||
import type { NextConfig } from "next";
|
import type { NextConfig } from "next";
|
||||||
|
|
||||||
|
/** Lets Shopify / custom domains embed the public widget in an iframe (Firefox blocks without this). */
|
||||||
|
const STOREFRONT_WIDGET_CSP = "frame-ancestors *";
|
||||||
|
|
||||||
const nextConfig: NextConfig = {
|
const nextConfig: NextConfig = {
|
||||||
/* config options here */
|
/* config options here */
|
||||||
|
async headers() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
source: "/storefront-chat/widget",
|
||||||
|
headers: [
|
||||||
|
{ key: "Content-Security-Policy", value: STOREFRONT_WIDGET_CSP },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
source: "/storefront-chat/widget/:path*",
|
||||||
|
headers: [
|
||||||
|
{ key: "Content-Security-Policy", value: STOREFRONT_WIDGET_CSP },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
},
|
||||||
// Keep Prisma + pg as Node externals so Turbopack does not bundle the
|
// Keep Prisma + pg as Node externals so Turbopack does not bundle the
|
||||||
// generated client (fixes "Cannot read properties of undefined (reading 'graph')"
|
// generated client (fixes "Cannot read properties of undefined (reading 'graph')"
|
||||||
// during `next build` in some Docker/Linux environments).
|
// during `next build` in some Docker/Linux environments).
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user