通过CORS策略已阻止从源"http://localhost:8080"访问"API_URL"处的XMLHttpRequest: [英] Access to XMLHttpRequest at 'API_URL' from origin 'http://localhost:8080' has been blocked by CORS policy:

查看:1045
本文介绍了通过CORS策略已阻止从源"http://localhost:8080"访问"API_URL"处的XMLHttpRequest:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Access to XMLHttpRequest at 'API_URL' from origin 'http://localhost:8080' 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.

运行我的本地主机系统以访问服务器API时.它会生成令牌,而不是出现上述错误之类的错误.请帮助我.

When I was run my localhost system to access server API. It will generate token instead of I am getting the error like above error. please help me.

推荐答案

基于大量研究解决了更正问题.我有一个解决方案.我已经参考了安装在我的应用程序中的文件ionic ionova插件.解决Cors问题.在下面给出文档URL: https://ionicframework.com/docs/native/http

Cors Issue Solved Based on Lot of research. I got one solution. I have refer the document like ionic cordova plugin installed in my App. fixing the Cors issue. Below given the document URL : https://ionicframework.com/docs/native/http

在其上执行实现".

我在下面获得了服务器API响应,如下所示.请帮助我.

I got Server API response below like this. please help me.

数据:"{" statusCode:" 1004,"消息:"授权失败}"

data: "{"statusCode":"1004","message":"Authorization failed"}"

这篇关于通过CORS策略已阻止从源"http://localhost:8080"访问"API_URL"处的XMLHttpRequest:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆