CORS Issue for Angular 13 app connecting to Web API Core hosted on Azure

Siddartha Pal 1 Reputation point

We have an Angular 13 front end app and a web API Core project hosted on Azure app service.
(FYI-We are using Azure AD authentication. We are using MSAL for Azure AD authentication)

When we run the Front end app locally and try to hit one end point ( web api running locally), we get the response without any issues.

But when the same code is deployed on Azure development environment and we test the same functionality, we are getting the following error:-

Access to XMLHttpRequest at ' from origin
'' has been blocked by CORS policy: Response to preflight
request doesn't pass access control check: It does not have HTTP ok status.
Any inputs would be very helpful.

best regards....

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,342 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
20,541 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Takahito Iwasa 4,841 Reputation points MVP

    Hi, @Siddartha Pal

    I understand that you are hosting the front app on and the API on and need to resolve the CORS issue.

    From the tag of this thread, is the API server hosted by App Service?
    You can change the setting to output the Access-Control-Allow-Origin header to by using the CORS function of App Service.

    See the following link:

    1 person found this answer helpful.