Skip to content

Commit e7164bb

Browse files
ai-edge-botcopybara-github
authored andcommitted
Serve LiteRT.js model tester with cors when run with npx
LiteRT-PiperOrigin-RevId: 820539591
1 parent 2d5f2c0 commit e7164bb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

litert/js/apps/model_tester/serve.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ const host = args['public'] ? '0.0.0.0' : '127.0.0.1';
5353
console.log(staticFilesPath);
5454

5555
const app = express();
56+
app.use((_req, res, next) => {
57+
// Set headers to enable Wasm pthread emulation.
58+
res.setHeader('Cross-Origin-Opener-Policy', 'same-origin');
59+
res.setHeader('Cross-Origin-Embedder-Policy', 'require-corp');
60+
next();
61+
});
5662
app.use('/', express.static(staticFilesPath));
5763
app.listen(args.port, host);
5864
console.log(

0 commit comments

Comments
 (0)