From 2d1c3a35ccc2ea3fcd2509d179f4e059cab9470c Mon Sep 17 00:00:00 2001 From: Chris Trevino Date: Thu, 9 Dec 2021 11:12:44 -0800 Subject: [PATCH 1/3] add headers required to re-enable sharedArrayBuffer --- lib/core-server/src/dev-server.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/core-server/src/dev-server.ts b/lib/core-server/src/dev-server.ts index 8226a9a2cba9..0e2cc2780e63 100644 --- a/lib/core-server/src/dev-server.ts +++ b/lib/core-server/src/dev-server.ts @@ -32,6 +32,10 @@ export async function storybookDevServer(options: Options) { app.use((req, res, next) => { res.header('Access-Control-Allow-Origin', '*'); res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept'); + // Required headers to enable SharedArrayBuffer + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer + res.header('Cross-Origin-Opener-Policy', 'same-origin'); + res.header('Cross-Origin-Embedder-Policy', 'require-corp'); next(); }); From 3cc4206f759d5be210e900caf2c5e6f2f4408567 Mon Sep 17 00:00:00 2001 From: Chris Trevino Date: Thu, 9 Dec 2021 11:25:46 -0800 Subject: [PATCH 2/3] add required headers to enable SharedArrayBuffer --- lib/core-server/src/dev-server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/core-server/src/dev-server.ts b/lib/core-server/src/dev-server.ts index 0e2cc2780e63..83e66f335d69 100644 --- a/lib/core-server/src/dev-server.ts +++ b/lib/core-server/src/dev-server.ts @@ -32,7 +32,7 @@ export async function storybookDevServer(options: Options) { app.use((req, res, next) => { res.header('Access-Control-Allow-Origin', '*'); res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept'); - // Required headers to enable SharedArrayBuffer + // These headers are required in order to enable SharedArrayBuffer // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer res.header('Cross-Origin-Opener-Policy', 'same-origin'); res.header('Cross-Origin-Embedder-Policy', 'require-corp'); From 2f2fff7e12306bb8c8b3e1ef52b0ea5122cd0c8f Mon Sep 17 00:00:00 2001 From: Chris Trevino Date: Thu, 9 Dec 2021 11:51:03 -0800 Subject: [PATCH 3/3] streamline comment --- lib/core-server/src/dev-server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/core-server/src/dev-server.ts b/lib/core-server/src/dev-server.ts index 83e66f335d69..f76fcee5baa9 100644 --- a/lib/core-server/src/dev-server.ts +++ b/lib/core-server/src/dev-server.ts @@ -32,7 +32,7 @@ export async function storybookDevServer(options: Options) { app.use((req, res, next) => { res.header('Access-Control-Allow-Origin', '*'); res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept'); - // These headers are required in order to enable SharedArrayBuffer + // These headers are required to enable SharedArrayBuffer // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer res.header('Cross-Origin-Opener-Policy', 'same-origin'); res.header('Cross-Origin-Embedder-Policy', 'require-corp');