wobuhuicode
V2EX  ›  Node.js

同一个域名下 post 为啥还给提示跨域而提交失败?

  •  
  •   wobuhuicode · Mar 29, 2016 · 4765 views
    This topic created in 3726 days ago, the information mentioned may be changed or developed.

    背景: NODE 做的后台 环境:在非 Chrome 下都能正常运行提交数据,只有 chrome 不行 警告语句: XMLHttpRequest cannot load http://XXX.com/login. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://www.XXX.com' is therefore not allowed access.

    请教一下这是怎么回事?

    6 replies    2016-03-30 09:05:15 +08:00
    lijinma
        1
    lijinma  
       Mar 29, 2016
    为什么说 xxx.comwww.xxx.com 是同域名?
    Infernalzero
        2
    Infernalzero  
       Mar 29, 2016
    XXX.comwww.XXX.com 是不同的域
    你 csp 限制了某些域名
    wobuhuicode
        3
    wobuhuicode  
    OP
       Mar 29, 2016
    @lijinma soga~看漏眼了
    wobuhuicode
        4
    wobuhuicode  
    OP
       Mar 29, 2016
    但是为啥就只有 chrome 不行?其他浏览器都可以
    @lijinma
    @Infernalzero
    wobuhuicode
        5
    wobuhuicode  
    OP
       Mar 29, 2016
    找到原因了~感谢两位提醒
    @Infernalzero
    @lijinma
    Lxxyx
        6
    Lxxyx  
       Mar 30, 2016
    @wobuhuicode 可以把原因 po 出来吗?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   922 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 44ms · UTC 20:56 · PVG 04:56 · LAX 13:56 · JFK 16:56
    ♥ Do have faith in what you're doing.