当我提出某些请求时,Symfony会丢失会话

时间:2016-11-18 12:26:40

标签: php angularjs symfony session angular

我正在使用角度2而我只是提出symfony请求问题,当我提出某些要求时,syfomy会丢失会话但是从远处到远处它起作用我不知道它会是什么我会留在下面一个有效的请求和另一个有效的请求如果你可以帮助我我会感激不尽

这是有效的

getOneEntidade(entid:number)
{
  this.token = this.cookieService.get("auth");

  let headers = new Headers({  'Content-Type': 'text/html' , 'Access-Control-Allow-Credentials': 'true', 'Authorization': 'Bearer ' + this.token});
  let options = new RequestOptions({ headers: headers, body: '', withCredentials: true});    
  return this.http.get(this.urlbase + "oneentidades/" + entid , options)
  .map((response: Response) => response.json());

}

这不起作用。

getpesquisa(pesquisa:string,  pag:number){

  this.token = this.cookieService.get("auth");

  let headers = new Headers({'Content-Type': 'text/html','Access-Control-Allow-Credentials': 'true', 'Authorization': 'Bearer ' + this.token});
  let options = new RequestOptions({ headers: headers, body: '', withCredentials: true});    
  return this.http.get(this.urlbase + "pesquisaentidades/" + pesquisa + "/" + pag , options)
  .map((response: Response) => response.json());
}

1 个答案:

答案 0 :(得分:0)

将其添加到config.yml

framework:
    session:
        cookie_domain: ".YOUR_DOMAIN"
        name: SFSESSID
        cookie_httponly: false