Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.4k views
in Technique[技术] by (71.8m points)

前端人员能独自解决掉跨域问题吗?

今天,一群前端同事围着我,让我这个“前端大佬”解决跨域的问题,我也是前端。 我紧张的要命。
浏览器里接口请求不通,如下报错:

Access to fetch at 'https://cmps.test.ceenk.com:9001/mgw.htm' from origin 'http://111.205.51.131:8876' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

请问,我有办法解决吗?
另外问一下,跨域问题是否与前端有关系?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

不能哦,想想如果你不需要支付宝同意,在你的网站就可以代替用户去调用支付宝接口,那不是乱了套了
跨域必须要后端进行一定的支持


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...