• Resolved 0ted0

    (@0ted0)


    Hello,
    I set up this plugin for the backend and SPA with React for the front, and get an error below when I call an endpoint from the frontend; When I call the endpoint via Postman or Curl, it works with no error. I modified Access-Control-Allow-Origin value to * in class-wp-headless-rest-api-cors.php, http.php and rest-api.php but it produces the same error. Any advice would be grateful.

    Access to fetch at ‘https://mydomain/wp-json/wp/v2/posts/7’ from origin ‘http://localhost:3000’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

Viewing 1 replies (of 1 total)
  • Thread Starter 0ted0

    (@0ted0)

    I modified .htaccess adding Headers, and browsers don’t produce cors error anymore. I hope it may be helpful.

Viewing 1 replies (of 1 total)
  • The topic ‘CORS error’ is closed to new replies.