the word press site needs to enable CORS. If you can not enable CORS, then you might want to configure an api proxy on the static website
My React application running on Azure Static web app as a front end and wordpress running on web app services as banckend i am having CORS policy isssue

Kunal Kumar
0
Reputation points
My React application running on Azure Static web app as a front end and wordpress running on web app services as banckend i am having CORS policy isssue
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,931 questions
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,173 questions
2 answers
Sort by: Most helpful
-
Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
2023-04-07T17:00:56.69+00:00 -
Grmacjon-MSFT 19,151 Reputation points Moderator
2023-04-12T22:08:06.8833333+00:00 Hello @Kunal Kumar Checking to see if you're still facing this issue. To fix the CORS policy issue between your React frontend and WordPress backend, you need to enable CORS on your WordPress backend. Here are the steps to enable CORS on WordPress:
- Install the "Enable CORS" plugin in your WordPress site.
- Activate the plugin and go to the settings page of the plugin.
- On the settings page, you will find the "Access-Control-Allow-Origin" option. Add the URL of your React app (e.g., https://myreactapp.azurestaticapps.net) to this option.
- Save the settings and restart your WordPress site. After enabling CORS on your WordPress backend, your React frontend should be able to make requests to your WordPress backend without any CORS policy issue. Hope that helps. -Grace