Azure static web app content blocked by CORS

Olie Denyer 0 Reputation points
2023-06-03T08:46:23.59+00:00

Over the last 2 days we have started to get errors accessing some content for our website that is hosted on Azure Static Web App. The errors point to an issue with pulling content from the CDN

"Access to fetch at 'https://market-assets.fra1.cdn.digital..... has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled"

THE CDN integration is part of the managed service and for the last few weeks has been working fine. Any help would be appreciated?

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
838 questions
{count} votes

1 answer

Sort by: Most helpful
  1. ajkuma 24,566 Reputation points Microsoft Employee
    2023-06-08T18:55:09.8666667+00:00

    @Olie Denyer , Just checking in to see if you had got a chance to see the previous response. 

    From the issue description I understand the issue started only from the couple of days. Do you recall making any changes prior to this issue? If there are multiple apps, is this issue confined only to this App? ("THE CDN integration is part of the managed service") Are you referring to, Azure CDN being configured for your app?

    If you haven't done this already. kindly review and try setting the following using a globalHeaders entry in your staticwebapp.config.json

    {
      "globalHeaders": {
        "Access-Control-Allow-Origin": "*",
        "Access-Control-Allow-Methods": "POST, GET, OPTIONS"
      }
    }
    

    Kindly let us know, I'll follow-up further.

    0 comments No comments