When we try to make a network request to a remote server whose origin is different from the current url (from which we are making the request), we are likely CORS errors are received due to different origin issues in the network, and while using a tool like Postman, we can successfully avoid this CORS error.
We need to explain the difference in response behavior when requesting over the network When requested via an extension like Postman.
When we use the network to make a network request to a domain that is different from the domain where our page is located the browser, which blocks the request without even notifying or contacting the server, For security reasons, same-origin requests are usually allowed.
But when we use Postman or any such tool, they are not restricted by this policy. network Pages can use XMLHttpRequest objects to send and receive data from remote servers, but They are subject to the same-origin policy, but extensions like Postman are not. one Extensions can communicate with remote servers outside of their origin, that's why Postman The request was made successfully, but the page failed with a CORS error.
The above is the detailed content of Why don't Postman get the ''Access-ControlAllow-Origin' header does not exist on the requested resource' error in JavaScript. For more information, please follow other related articles on the PHP Chinese website!