redirect(url)如何重定向跨域的非简单请求

跨域 的非简单请求如何重定向


用redirect(url)试了一下,并不可以,求解,谢谢

评论区

happyboy

2019-01-23 20:39

说实话,我没看明白你的意思,估计波总也看不明白。

水镜先生

2019-01-24 09:31

@happyboy 跨域的非简单请求,请求结束后需要重定向到一个别的URL比如“www.baidu.com”

happyboy

2019-01-24 10:25

@水镜先生 你得这么写:redirect("http://www.baidu.com");
我试过了,可以跳转。

水镜先生

2019-01-24 10:27

@happyboy 当请求是跨域非简单请求(就是你要传请求头)的时候就不能打开了

水镜先生

2019-01-24 10:28

Access to XMLHttpRequest at 'http://www.taobao.com/' (redirected from 'http://192.168.0.36:8081/pay/nzvcePay/pay') from origin 'null' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request.

水镜先生

2019-01-24 10:29

最后一句话就是非简单请求不能重定向

happyboy

2019-01-24 10:45

@水镜先生 这叫预检请求,我感觉这个问题在于你的目标方,比如你上面的淘宝。最好让波总给你看一下,^_^

南城

2019-06-05 15:16

我也是这个问题,兄弟,你解决了吗。Access to XMLHttpRequest at 'https://m.mallcoo.cn/a/open/User/V2/OAuth/BaseInfo/?AppID=5cf4f5594ba1f2260842bb24&PublicKey=rl9trK&CallbackUrl=http%3A%2F%2Fskpcoupons.local%2Findex%2Findexapi%2FgetVipCard' (redirected from 'http://skpcoupons.local/index/indexapi/getVipCard') from origin 'http://skpcoupons.local' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request.

南城

2019-06-05 15:17

Access to XMLHttpRequest at 'https://m.mallcoo.cn/' (redirected from 'http://skpcoupons.local/index/indexapi/getVipCard') from origin 'http://skpcoupons.local' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request.

we

2019-11-16 16:34

解决了吗,有没有解决方法分享一下

热门反馈

扫码入社