且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何解决“重定向已被 CORS 策略阻止:没有 'Access-Control-Allow-Origin' 标头"?

更新时间:2021-08-15 22:00:55

除了 awd 提到的让负责服务器的人重新配置(本地开发的一种不切实际的解决方案)之外,我还使用了一个 change-origin chrome 插件,例如这个:

In addition to what awd mentioned about getting the person responsible for the server to reconfigure (an impractical solution for local development) I use a change-origin chrome plugin like this:

Moesif Orign &CORS 转换器

您可以使您的本地开发服务器(例如:localhost:8080) 看起来来自172.16.1.157:8002 或任何其他域.

You can make your local dev server (ex: localhost:8080) to appear to be coming from 172.16.1.157:8002 or any other domain.