• Resolved emiltsang

    (@emiltsang)


    Access to XMLHttpRequest at ‘/wp/v2/categories’ from origin ‘localhost’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

    I have added the cors headers to the functions.php under the Theme folder.
    I was able to fetch the posts with the endpoint /v2/posts.

    However, when I made request to /v2/categories,
    the cors issue appears again.

    Is there any configurations I missed?

    • This topic was modified 2 years, 6 months ago by emiltsang.
    • This topic was modified 2 years, 6 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Developing with WordPress topic
Viewing 2 replies - 1 through 2 (of 2 total)
  • Hey, try adding this to the .htaccess file of your Root domain. (Usually /public_html/ )

    <IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin "*"
    </IfModule>
    Thread Starter emiltsang

    (@emiltsang)

    Thanks gytisp,
    after updating the cors settings in .htacess file,
    I am able to call the /v2/categories endpoint.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Blocked by CORS on /v2/categories requests’ is closed to new replies.