XSRF检查在发布到jira后在角度中失败

时间:2019-03-13 15:40:49

标签: angular

当我想向JIRA添加新成员时,发帖请求有问题。 对于Firefox和Internet Explorer,一切运行正常。仅对于Chrome,我仍然无法解决XSRF检查失败。请帮忙。

这是我的标题chromehttpOptions = { headers: new HttpHeaders({ Authorization: JSON.parse(sessionStorage.getItem('pttk-user')).token, 'X-Atlassian-Token': 'nocheck', 'Content-Type': 'application/json', 'Access-Control-Allow-Origin': '*', 'X-Requested-With': 'XMLHttpRequest', 'Set-Cookie': 'JSESSIONID=A193DF912718D7B98CAAA1344EA34FC3; Path=/; HttpOnly' }), withCredentials: true }

1 个答案:

答案 0 :(得分:0)

从客户端删除'Access-Control-Allow-Origin':'*'标头,您是否确实需要x-requested-with等。可能还需要设置一个原点。首先尝试不使用。

chromehttpOptions = {
            headers: new HttpHeaders({
                'Authorization': JSON.parse(sessionStorage.getItem('pttk-user')).token,
                'Origin', "http(s)://server:port/"
                'X-Atlassian-Token': 'nocheck',
                'Content-Type': 'application/json',
                'X-Requested-With': 'XMLHttpRequest',
                'Set-Cookie': 'JSESSIONID=A193DF912718D7B98CAAA1344EA34FC3; Path=/; HttpOnly'
            }),
            withCredentials: true
        }