x***@qq.com
x***@qq.com
  • 发布:2019-02-23 06:54
  • 更新:2020-05-06 14:55
  • 阅读:2934

uni.request session 问题

分类:uni-app
  1. 前端 用uni.request请求, 无法获取到 登录 时的sessionid, 跨域也做了
    uni.request({
    url:'http://localhost/rest/tables.shtml',
    method:"POST",
    async: true,
    data:{"restid":124},
    xhrFields:{
    withCredentials:true
    },
    crossDomain: true,
    header:{
    'Content-Type': 'application/x-www-form-urlencoded',
    'token' : token,
    },
    success:function(res){
    console.log(res);
    }
    })
  2. 后端代码 springmvc,
    response.setHeader("Access-Control-Allow-Origin", request.getHeader("origin"));
    response.setHeader("Access-Control-Allow-Credentials", "true");
    response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
    response.setHeader("Access-Control-Max-Age", "0");
    response.setHeader("Access-Control-Allow-Headers", "Origin, No-Cache, X-Requested-With, If-Modified-Since, Pragma, Last-Modified, Cache-Control, Expires, Content-Type, X-E4M-With,token");

System.out.println(session.getId());

2019-02-23 06:54 负责人:无 分享
已邀请:
1***@163.com

1***@163.com

解决了么?

  • z***@163.com

    解决了么? 我后台也获取不到session信息

    2019-09-19 21:38

蜂巢

蜂巢

解决了吗

该问题目前已经被锁定, 无法添加新回复