问题:
今天遇到了一个前端调用后端的报错:Access to XMLHttpRequest at 'xx' from origin 'XXX' has been blocked by CORS policy: Cross origin requests are only supported for protocol scheme: http,data,chrome,chrome-extension,chrome-untrusted,https,
一直以为是后端跨域问题,但是后端明显已经加了跨域。
在网上搜各种资料,安装anywhere,安装live server。都不行。。
我了个天,其实问题很简单,请求网址写错了
解决方案:
错误地址:localhost:1000/mytest/getFile
正确地址:http://localhost:1000/mytest/getFile
我一定是瞎了,要不然不会花费近两小时来排查这个问题。mark。