antd-admin icon indicating copy to clipboard operation
antd-admin copied to clipboard

CORS跨域可能是个bug,请看看

Open FatFatFox opened this issue 9 years ago • 2 comments

request.js里有个判断 if (CORS && CORS.indexOf(origin) > -1) 则流向CORS分支。 作者可能的意思是在config.js的CORS项里配置要跨域的http地址之后,就可以通过CORS方式获取这个地址的跨域数据了。 但是,即使配了,CORS.indexOf(origin)也永远都是等于-1的,进不到这个分支。 不太了解ES6标准,以往的经验看,这是不是检查字符串是否含有特定地址?

config.js代码改了一下就可以了 CORS: 'http://localhost:7001,http://192.168.0.106:8080/,http://192.168.0.190:8080/',

感谢zuiidea这个开源项目,谢谢

FatFatFox avatar May 05 '17 08:05 FatFatFox

CORS: ['http://localhost:7001','http://192.168.0.106:8080','http://192.168.0.190:8080'] 没有斜杠就对了

zuiidea avatar May 05 '17 09:05 zuiidea

果真如此,看来是我搞错了。

FatFatFox avatar May 05 '17 10:05 FatFatFox