Why CORS errors in API call by React App hosted in Azure AppService once after applying domain redirection rules in we.config file of the react app

Developer 0 Reputation points
2024-01-29T14:47:02.02+00:00

Root domain Redirection rules in config file causing the issue to redirect wildcard domains giving CORS Errors. the below rules has been applied but getting CORS errors in while calling wilcard domains in React app hosted on to Azure AppService. below is the rewrite rules in web.config file of ReactApp hosted in AppService.


Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,930 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Saravanan Ganesan 1,830 Reputation points MVP
    2024-01-29T19:25:28.01+00:00

    Hi ,

    The CORS errors in your React app, hosted in Azure AppService, may be caused by the root domain redirection rules. When redirecting wildcard domains, CORS issues can arise. To resolve this, ensure that your CORS policy allows requests from all relevant domains. Additionally, validate that the server responds with appropriate CORS headers. Review your CORS configuration and adjust it to accommodate both the root and wildcard domains. Testing with wildcard domains in different environments can help identify and address any specific CORS-related challenges. Regards , Saravanan Ganesan.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.