如何发送设置Cookie头Angular2,Ionic 2

如何发送设置Cookie头Angular2,Ionic 2,angular,ionic2,session-cookies,Angular,Ionic2,Session Cookies,我正在尝试使用set Cookie头设置会话id。 角度2代码: let headers=new headers()//标题 append('Set-Cookie','PHPSESSID='+sha1(APP_CONFIG.localHost)+';path=/')//设置我自己的cookie id let options=new RequestOptions({//设置请求选项 标题:标题, 证书:正确 }); this.http.get(url,选项)解决方案是我需要使用not Set C

我正在尝试使用set Cookie头设置会话id。 角度2代码:

let headers=new headers()//标题
append('Set-Cookie','PHPSESSID='+sha1(APP_CONFIG.localHost)+';path=/')//设置我自己的cookie id
let options=new RequestOptions({//设置请求选项
标题:标题,
证书:正确
});

this.http.get(url,选项)解决方案是我需要使用not Set Cookie头。我需要使用Cookie头。但问题是,我的谷歌浏览器是拒绝它。解决方案是使用包含会话id的参数查询服务器,并在服务器端设置它。

这是cors问题。。在服务器端的设备中并不重要。在设置访问控制允许原点的地方,将
*
更改为
http://localhost:8100
当trueI将此标题添加到响应中时,如果您具有凭据
,则不能允许
*
。但要将Cookie头设置为存在。它可以是什么?我可以将cookies用于经过身份验证的web api吗?