My application is a client side only app currently running on localhost. I am trying to use a Wasm library that requires access to SharedArrayBuffer. It is working on Chrome and Edge, however it seems Firefox has put restrictions in place resulting in an error:
ReferenceError: SharedArrayBuffer is not defined
According to MDN Firefox requires the following headers to be set:
Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corp
My app is running on localhost:4200. I am trying to get the ng serve development server to set the headers. I have attempted to do this with the following code:
// proxy.conf.js
module.exports = {
"/": {
logLevel: "debug",
target: "http://localhost:4200",
bypass: (req, res, proxyOptions) => {
res.setHeader("Cross-Origin-Opener-Policy", "same-origin");
res.setHeader("Cross-Origin-Embedder-Policy", "require-corp");
},
},
};
However this does not work. Is there either a way to set the headers with the Angular server, or another workaround?