【发布时间】:2018-05-29 21:38:57
【问题描述】:
我正在尝试从服务器获取数据,但出现以下错误:
预检响应包含无效的 HTTP 状态代码 403。
getGroupsResponse():
Observable<IMainPageGroupResponseModel> {
this.dataUrl='http://localhost:8080/myApp/v1/Lookup/groups/list/19763';
const headers = new Headers({ 'Content-Type': 'application/json' });
headers.append('Access-Control-Allow-Origin', '*');
const options = new RequestOptions({ headers:headers });
return this.http.get(this.dataUrl,options)
.map((response:Response) => <IMainPageGroupResponseModel>response.json())
.catch(this.handleError);
}
我已经安装了 chrome 的核心插件,我的应用在 4300 端口,服务器端代码在 8080 端口本地运行。
我不明白为什么会出现此错误
【问题讨论】:
标签: angular