title: Setting Cross-origin-Embedder-Policy and Cross-origin-Opener-Policy headers in nodejs
body: <p>I've been developping a website using express(NodeJS) for the backend and React for the frontend. I've come accross the issue where my application won't work on Firefox due to this error &quot;ReferenceError: SharedArrayBuffer is not defined&quot;.
  After having searched a bit online, it appears it has to do with CORS. I saw that on Chrome there is a warning about the use of SharedArrayBuffer as well.</p>
  <p>So I read that I need to set those headers
  ̀<code>Cross-Origin-Opener-Policy: same-origin  Cross-Origin-Embedder-Policy: require-corp </code></p>
  <p>But I am not sure on how to do that. On my backend I've been using the cors package to set my cors headers and options as such</p>
  <pre><code>const corsOptions = {
    origin: process.env.CLIENT_URL,
    credentials: true,
    'allowedHeaders': ['sessionId', 'Content-Type'],
    'exposedHeaders': ['sessionId'],
    'methods': 'GET,HEAD,PUT,PATCH,POST,DELETE',
    'preflightContinue': false
  }
  app.use(cors(corsOptions)); 
  </code></pre>
  <p>I've also tried using this method but it doesn't appear to work either :</p>
  <pre><code>app.use((req, res, next) =&gt; {
    res.setHeader('Access-Control-Allow-Origin', '*');
    res.setHeader('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content, Accept, Content-Type, Authorization');
    res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, PATCH, OPTIONS');
    res.setHeader('Cross-origin-Embedder-Policy', 'require-corp');
    res.setHeader('Cross-origin-Opener-Policy','same-origin');
    next();
  });
  
  </code></pre>
  <p>Am I totally missing something/misunderstanding?
  It is my first time developping a web application and I am kind of lost at this point. Any help would be grately appreciated.</p>
  <p>Thank you</p>