请求的资源上不存在 'Access-Control-Allow-Origin' header 不适用于邮递员

No 'Access-Control-Allow-Origin' header is present on the requested resource does not apply to postman

我已经实现了 restful 服务。我已经使用应用程序中的 ajax 请求以及邮递员客户端对其进行了测试,两者均有效。但是当我尝试从另一个应用程序发送 ajax 请求时,我在浏览器控制台中收到以下错误。

http://localhost:8080/AusIncomeCalculator/AUSTax/post. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8089' is therefore not allowed access.

我不明白邮递员客户端如何获得成功响应而其他应用程序却不能。

RESTful 服务托管在 JBOSS-eap 7.0 中,高枕无忧

发生这种情况是出于安全原因,浏览器限制从脚本内发起的跨源 HTTP 请求。Postman 是一个 REST 客户端,它在 Chrome 浏览器中作为应用程序运行。专为测试rest API而设计,因此不限制跨源资源请求。