来源“http://localhost:3000”已被 CORS 策略阻止

问题描述 投票:0回答:1

当我从源“http://localhost:3000”获取数据时,在“http://dash.thesportk.com/api/front”访问 XMLHttpRequest 已被 CORS 策略阻止:响应预检请求未通过访问控制检查:预检请求不允许重定向。

useEffect(() => { const fetchData = async () => {

  axios.get('http://dash.thesportk.com/api/front?api_token=MY_TOKEN').then(res=>{
    console.log('res',res)
  })

};

当我输入正确的令牌和正确的标题时,我也会收到错误请求帮助

reactjs laravel api
1个回答
0
投票

您可以尝试使用Chrome扩展绕过CORS或要求后端开发人员将localhost添加到白名单

© www.soinside.com 2019 - 2024. All rights reserved.