码迷,mamicode.com
首页 > 其他好文 > 详细

nginx 实现跨域

时间:2017-12-22 03:39:29      阅读:169      评论:0      收藏:0      [点我收藏+]

标签:cross   test   ros   跨域   fun   bsp   main   头部   ati   

 

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(){
      }
});

 

nginx 实现跨域

标签:cross   test   ros   跨域   fun   bsp   main   头部   ati   

原文地址:http://www.cnblogs.com/rongkang/p/7997486.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!