$ HTTP GET铬不发送JSESSIONID但工程在Firefox angularjs [英] $http GET doesn't send JSESSIONID in chrome but works on firefox angularjs

查看:190
本文介绍了$ HTTP GET铬不发送JSESSIONID但工程在Firefox angularjs的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有这个code

so I have this code

$http({
     'method': 'GET',
         'url': 'http://www.example.com',
         'withCredentials': true,
     headers: {
         'Content-type': 'application/json'
     }
 }).
 success(function (data, response, headers, status) {

});

这将与记录的JSON数组返回,以及HTTP请求是使用凭据这是一个JSESSIONID,每连续调用后端使用。

This will return with the JSON array of records, well the http request is using credentials which is a JSESSIONID that use for every consecutive calls to the backend.

问题是,它工作在Firefox,但无法在Chrome。因此,Firefox没有发送包含JSESSIONID饼干,但没有镀铬,而我已经设置了 withCredentials 真正

The problem is, it works on firefox but doesn't on chrome. So firefox does send the cookies containing the JSESSIONID but not chrome while I already set the withCredentials to true

为什么会出现这种情况?

Why does this happen?

推荐答案

这是CORS例外,当你试图从另一个域,给予你的错误,的更多关于CORS

This is the CORS exception, when you trying to load data from another domain that giving you error , more about CORS

,并检查我的答案如何启用对角的js CORS,但不幸的是,你的服务器还必须启用CORS

and also check my answer how to enable CORS on angular js, but unfortunately you server also must enable CORS

<一个href=\"http://stackoverflow.com/questions/24598187/error-when-accessing-localhost-api-in-chrome-neterr-insecure-response/24627487#24627487\">more它

这篇关于$ HTTP GET铬不发送JSESSIONID但工程在Firefox angularjs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆