diff --git a/docs/ensnode.io/astro.config.mjs b/docs/ensnode.io/astro.config.mjs index 01fc65f8a..9db423000 100644 --- a/docs/ensnode.io/astro.config.mjs +++ b/docs/ensnode.io/astro.config.mjs @@ -14,7 +14,28 @@ export default defineConfig({ site: "https://ensnode.io", trailingSlash: "never", integrations: [mermaid(), starlight(), sitemap(), react(), mdx(), icon()], + server: { + // for production build + headers: { + "cross-origin-opener-policy": "same-origin", + "cross-origin-embedder-policy": "credentialless", + }, + }, vite: { + plugins: [ + tailwindcss(), + { + name: "cross-origin-isolation-headers", + configureServer(server) { + server.middlewares.use((_req, res, next) => { + // for development build + res.setHeader("cross-origin-embedder-policy", "credentialless"); + res.setHeader("cross-origin-opener-policy", "same-origin"); + next(); + }); + }, + }, + ], resolve: { alias: { "@assets": fileURLToPath(new URL("./src/assets", import.meta.url)), @@ -30,7 +51,6 @@ export default defineConfig({ ssr: { noExternal: ["@namehash/namehash-ui"], }, - plugins: [tailwindcss()], }, redirects: { "/docs": "/docs/integrate", diff --git a/docs/ensnode.io/src/components/molecules/CodePlayground.tsx b/docs/ensnode.io/src/components/molecules/CodePlayground.tsx index f48cb701c..16fed18eb 100644 --- a/docs/ensnode.io/src/components/molecules/CodePlayground.tsx +++ b/docs/ensnode.io/src/components/molecules/CodePlayground.tsx @@ -68,6 +68,7 @@ export default function CodePlayground({ view: stackBlitzViewForPlayground(view), // embed project should use light theme because it's used in the docs theme: "light", + crossOriginIsolated: true, }) as EmbedOptions, [resolvedOpenFile, terminalHeight, height, view], ); diff --git a/docs/ensnode.io/vercel.json b/docs/ensnode.io/vercel.json index 57f2a935e..68cdaadca 100644 --- a/docs/ensnode.io/vercel.json +++ b/docs/ensnode.io/vercel.json @@ -1,4 +1,13 @@ { "$schema": "https://openapi.vercel.sh/vercel.json", - "trailingSlash": false + "trailingSlash": false, + "headers": [ + { + "source": "/(.*)", + "headers": [ + { "key": "cross-origin-opener-policy", "value": "same-origin" }, + { "key": "cross-origin-embedder-policy", "value": "credentialless" } + ] + } + ] }