nginx 添加头部跨域。

location / {
    add_header 'Access-Control-Allow-Origin' '*'; //允许的域
    add_header 'Access-Control-Allow-Credentials' 'true';  //允许cookie
}

 

 

前端ajax session id 不一致问题:

$.ajax({
    url:url,
    xhrFields: {
      withCredentials: true
      },
    crossDomain: true,
    success:function(result){
      alert(“test”);
      },
    error:function(){
      }
});

 

相关文章:

  • 2021-07-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-20
  • 2021-06-20
  • 2021-10-11
猜你喜欢
  • 2021-08-13
  • 2021-11-29
  • 2022-12-23
  • 2021-11-27
  • 2021-06-21
  • 2021-09-30
相关资源
相似解决方案