Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

axios 请求,报跨域

正常请求,都OK,没毛病。
有一个字段的长度是1000,我填满这个字段,发起请求,浏览器直接给我报了跨域

from origin 'http://localhost:8081' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

在线等待,求高手告知问题原因。


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

1 Answer

0 votes
by (71.8m points)

简单说一下原因,axios的请求,接收参数处接收字段写错了,导致所有的参数被放在地址栏传递,而地址栏的数据如果超过一定的范围会报跨域,因此我这里的跨域原因如上。是我自己封装的axios请求有问题导致。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...