【发布时间】:2019-05-17 04:14:28
【问题描述】:
我在与 AspNetBoilerplate angular app 的公共 REST API 集成时遇到问题。
无论我调用哪个外部服务,我都会返回 CORS 错误,因为调用会在标头中获取编译指示。
这是我在控制台中遇到的错误:
from origin 'http://localhost:4200' 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.
这发生在最简单的调用中:
this.http.get('http://maps.google.com/places').subscribe(result => console.log(result));
我觉得是 HTTP interceptor 在这里困扰着我,但我需要指导我应该如何以 ABP 的方式解决这个问题。
当然,我已经制作了 angular injectable services 来包含我的 HTTP 客户端请求。
【问题讨论】:
标签: angular cors aspnetboilerplate abp