# No 'Access-Control-Allow-Origin' header is present on the requested resource

**URL:** <https://community.postman.com/t/no-access-control-allow-origin-header-is-present-on-the-requested-resource/22199>\
**Category:** Help Hub\
**Created:** [April 2, 2021, 8:11am UTC](https://community.postman.com/t/no-access-control-allow-origin-header-is-present-on-the-requested-resource/22199 "2021-04-02T08:11:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Valdinia](https://avatars.discourse-cdn.com/v4/letter/v/3e96dc/32.png) [@Valdinia](https://community.postman.com/u/Valdinia)\
**Post date:** [April 2, 2021, 8:11am UTC](https://community.postman.com/t/no-access-control-allow-origin-header-is-present-on-the-requested-resource/22199/1 "2021-04-02T08:11:36Z")

</div>

In Postman this Post request runs just perfect:  
var settings = {  
“url”: “[https://webservicesp.anaf.ro/AsynchWebService/api/v5/ws/tva](https://webservicesp.anaf.ro/AsynchWebService/api/v5/ws/tva)”,  
“method”: “POST”,  
“timeout”: 0,  
“headers”: {  
“Content-Type”: “application/json”  
},  
“data”: JSON.stringify([{“cui”:2864518,“data”:“2021-03-29”}]),  
};

$.ajax(settings).done(function (response) {  
console.log(response);  
});

But when I try to run it from from our WordPress web-store, from a .js file when leaving a field:  
$(’#billing\_cui’).blur(  
function(){…

I get:  
Access to XMLHttpRequest at ‘[https://webservicesp.anaf.ro/AsynchWebService/api/v5/ws/tva](https://webservicesp.anaf.ro/AsynchWebService/api/v5/ws/tva)’ from origin ‘https://…’ 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.  
[webservicesp.anaf.ro/AsynchWebService/api/v5/ws/tva:1](http://webservicesp.anaf.ro/AsynchWebService/api/v5/ws/tva:1) Failed to load resource: net::ERR\_FAILED

---

<div class="post-metadata">

**Author:** ![pranavdavar](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/pranavdavar/32/9152_2.png) [@pranavdavar](https://community.postman.com/u/pranavdavar)\
**Post date:** [April 2, 2021, 3:53pm UTC](https://community.postman.com/t/no-access-control-allow-origin-header-is-present-on-the-requested-resource/22199/2 "2021-04-02T15:53:51Z")

</div>

Hi @Valdinia, Welcome to Community!

It seems the endpoint which you are trying to use has CORS policy enabled. You need to pass headers like the one mentioned “Access-Control-Allow-Origin” in your error message.

Generally postman includes these headers by default. To verify this you can check for hidden or auto populated headers under header tab in postman else you can also find in postman console what all headers were sent in the request payload.

If policy is there you may need to pass extra headers to align with CORS policy in your JS script from wordpress.

Hope this helps 🙂

---

<div class="post-metadata">

**Author:** ![Valdinia](https://avatars.discourse-cdn.com/v4/letter/v/3e96dc/32.png) [@Valdinia](https://community.postman.com/u/Valdinia)\
**Post date:** [April 2, 2021, 5:11pm UTC](https://community.postman.com/t/no-access-control-allow-origin-header-is-present-on-the-requested-resource/22199/3 "2021-04-02T17:11:16Z")

</div>

Thank you for your answer!

---

<div class="post-metadata">

**Author:** ![vapingkingdom](https://avatars.discourse-cdn.com/v4/letter/v/67e7ee/32.png) [@vapingkingdom](https://community.postman.com/u/vapingkingdom)\
**Post date:** [April 30, 2021, 9:53am UTC](https://community.postman.com/t/no-access-control-allow-origin-header-is-present-on-the-requested-resource/22199/5 "2021-04-30T09:53:36Z")

</div>

Have you found a solution yet? i`m struggling with the same exact problem…

---

<div class="post-metadata">

**Author:** ![johanepic](https://avatars.discourse-cdn.com/v4/letter/j/aca169/32.png) [@johanepic](https://community.postman.com/u/johanepic)\
**Post date:** [September 20, 2021, 6:23am UTC](https://community.postman.com/t/no-access-control-allow-origin-header-is-present-on-the-requested-resource/22199/6 "2021-09-20T06:23:57Z")

</div>

The error you get is due to the CORS standard, which sets some restrictions on how [JavaScript](http://net-informations.com/js/iq/default.htm) can perform ajax requests.

The CORS standard is a client-side standard, implemented in the browser. So it is the browser which prevent the call from completing and generates the error message - not the server.

Postman does not implement the CORS restrictions, which is why you don’t see the same error when making the same call from Postman.

Why doesn’t Postman implement CORS? CORS defines the restrictions relative to the origin (URL domain) of the page which initiates the request. But in Postman the requests doesn’t originate from a page with an URL so CORS does not apply.

---

<div class="post-metadata">

**Author:** ![spacecraft-architec4](https://avatars.discourse-cdn.com/v4/letter/s/43a26b/32.png) [@spacecraft-architec4](https://community.postman.com/u/spacecraft-architec4)\
**Post date:** [March 24, 2022, 4:39pm UTC](https://community.postman.com/t/no-access-control-allow-origin-header-is-present-on-the-requested-resource/22199/7 "2022-03-24T16:39:29Z")

</div>

When using the Postman website to make the requests, are we still using the Postman app instead of the brwoser, when making the API request to the API server?

---

<div class="post-metadata">

**Author:** ![murrah](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/murrah/32/13141_2.png) [@murrah](https://community.postman.com/u/murrah)\
**Post date:** [September 5, 2022, 9:52pm UTC](https://community.postman.com/t/no-access-control-allow-origin-header-is-present-on-the-requested-resource/22199/8 "2022-09-05T21:52:52Z")

</div>

I couldn’t make this work either.  
My server was definitely running and I could make WS connections on localhost:8080 using a test index.html page using the JS websocket API.

I gave up and installed the [WebSocket King](https://chrome.google.com/webstore/detail/websocket-king-client/cbcbkhdmedgianpaifchdaddpnmgnknn) Chrome extension and it worked out of the box, no issues.

Just FYI.  
Thanks,  
Murray
