COOP and COEP with Phoenix

Hello everyone,

Recently I stumbled upon

COOP: Cross Origin Opener Policy
COEP: Cross Origin Embedder Policy

For context, I was using ffmepg wasm version on the client side. It uses SharedArrayBuffer, and now it requires some additional settings. It requires to pass special headers in the response.

This is the deprecation warning.

[Deprecation] SharedArrayBuffer will require cross-origin isolation as of M92, around July 2021. See for more details.

and now it is

ReferenceError: SharedArrayBuffer is not defined

To make it work, and as a temporary solution, I added what was needed like this …

    conn = conn
    |> Plug.Conn.put_resp_header("Cross-Origin-Embedder-Policy", "require-corp")
    |> Plug.Conn.put_resp_header("Cross-Origin-Opener-Policy", "same-origin")

… before rendering the page using ffmpeg wasm.

Do You have this COOP and COEP problem? And if yes, did You find a nicer solution?

Thanks for taking time

1 Like