V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
zengxiangjun
V2EX  ›  程序员

求教 Refused to set unsafe header "Cookie" 如何解决

  •  
  •   zengxiangjun · 2018-05-06 11:37:15 +08:00 · 8137 次点击
    这是一个创建于 2154 天前的主题,其中的信息可能已经有所发展或是发生改变。
    1. a.site.com 跨域请求了 b.site.com 的接口(注意是二级域)
    2. 在发起的前端 ajax 请求中已经设置了 crossDomain 为 true, 并且 withCredentials 为 true
    3. b.site.com 的接口正确返回了结果
    4. 但浏览器端依然报错:Refused to set unsafe header "Cookie"

    环境:chrome。向各位大神求解

    kfll
        1
    kfll  
       2018-05-06 15:59:22 +08:00 via iPhone
    Ajax 不允许手动指定 Cookie Header,详见 MDN
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3724 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 05:04 · PVG 13:04 · LAX 22:04 · JFK 01:04
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.