feat(37-01): add COOP/COEP headers to Express server for SharedArrayBuffer support
- Add Cross-Origin-Opener-Policy: same-origin middleware before all routes - Add Cross-Origin-Embedder-Policy: require-corp middleware before all routes - Required for @ricky0123/vad-react (VAD uses SharedArrayBuffer internally)
This commit is contained in:
parent
29d02c2e10
commit
ee5538e5a4
1 changed files with 7 additions and 0 deletions
|
|
@ -83,6 +83,13 @@ export async function createApp(
|
||||||
) {
|
) {
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
|
// COOP/COEP headers required for SharedArrayBuffer (VAD voice activity detection)
|
||||||
|
app.use((_req, res, next) => {
|
||||||
|
res.setHeader("Cross-Origin-Opener-Policy", "same-origin");
|
||||||
|
res.setHeader("Cross-Origin-Embedder-Policy", "require-corp");
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
|
||||||
app.use(express.json({
|
app.use(express.json({
|
||||||
// Company import/export payloads can inline full portable packages.
|
// Company import/export payloads can inline full portable packages.
|
||||||
limit: "10mb",
|
limit: "10mb",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue