We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
想在config里设置proxyTable来完成跨域,但是发现封装后的axios就不能实现跨域。。。但是直接用axios就可以走config里的proxy配置。。。不知何解?
The text was updated successfully, but these errors were encountered:
首先axios在浏览器是环境,是在XMLHttpRequests上做了一层封装,本质其实就是ajax,既然是ajax就避免不了跨域的问题。对于这种情况,要么服务端的接口加一个响应头Access-Control-Allow-Origin,要么通过node这种中间层帮忙做一个转发。这里的话,你可以用webpack-dev-server去做,具体用法参考这里webpack-dev-server代理配置 至于你说的axios里的proxy,仅仅帮你加个自定头“Proxy-Authorization”而已,并没有解决跨域问题
Sorry, something went wrong.
嗯嗯,问题已经解决了。。。thx for reply
No branches or pull requests
想在config里设置proxyTable来完成跨域,但是发现封装后的axios就不能实现跨域。。。但是直接用axios就可以走config里的proxy配置。。。不知何解?
The text was updated successfully, but these errors were encountered: