C#C
C#•13mo ago
kopale.

Azure Static Web App (Blazor) problem with CORS

Hello, I have been developing a blazor wasm app that uses multi threading. The problem is that I don't know how can i set these headers Cross-Origin-Embedder-Policy:require-corp & Cross-Origin-Opener-Policy:same-origin.

I tried to set them like the docs suggested in staticwebapp.config.json like:
{
  "globalHeaders": {
    "Cross-Origin-Embedder-Policy": "require-corp",
    "Cross-Origin-Opener-Policy": "same-origin"
  }
}

Still the headers are not set, but the workflow run passes anyway.

In local using dotnet serve it works that way: dotnet serve -h "Cross-Origin-Opener-Policy:same-origin" -h "Cross-Origin-Embedder-Policy:require-corp" --directory bin\Release\net9.0\publish\wwwroot

What am I doing wrong? Can somebody please give me a working staticwebapp.config.json? Thank you 🙂

PS: The app is full client side, no api calls.
Was this page helpful?