vercel / serve

Static file serving and directory listing
https://npmjs.com/package/serve
MIT License
9.39k stars 693 forks source link

Flag to allow WebAssembly SharedArrayBuffer #729

Open airone01 opened 2 years ago

airone01 commented 2 years ago

Description

Please add an argument such as -w --wasm that activate the following headers:

Why

This would allow users to use serve to test WebAssembly components from their browser, provided they use a valid SSL certificate or pipe the server though a secure tunnel service such as ngrok. Refer to the MDN docs articles on SharedArrayBuffer, as well as COOP and COEP.

It is possible to do it from a config file, as seen in #606 and in the docs but it'd generally be easier to have a single argument than having to write a config, especially when you run serve from a dist/build folder which is excluded in a .gitignore.

Alternatives

As an alternative, we can have the -C --cors argument pass the Cross-Origin-Opener-Policy: same-origin and Cross-Origin-Embedder-Policy: require-corp headers as well, but as it may pose security problem because of unwanted behavior, it's probably not a good idea.

KaivnD commented 11 months ago

any updates?