Azure Static Web Site / CORS question

ScottM 331 Reputation points
2020-07-31T14:34:14.337+00:00

For Azure Static Web site, how do you deal with the issue when SPA (angular app) needs to make cross domain api call? Seems like CORS would be needed in this scenario but not sure how to address CORS with static web site.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,685 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Grmacjon-MSFT 15,156 Reputation points
    2020-08-02T05:22:19.107+00:00

    Hi @ScottM

    Updating my earlier response --

    CORS is not supported with static website but CORS is handled automatically for Azure Static Web App. When you call a Functions endpoint from a static page in an Azure Static Web Apps site, all the CORS settings are set up for you by default.

    You can get started with Azure Web Apps with Angular following this tutorial.

    Hope that helps.

    -Grace


  2. Tomislav Markovski 1 Reputation point
    2021-12-25T13:28:49.803+00:00

    A good approach would be to setup a CDN for your static website and configure CORS. This works with static websites setup on a storage account or regular web app service.

    https://learn.microsoft.com/en-us/azure/cdn/cdn-cors

    0 comments No comments