HTTPS请求:CORS错误,但我仍然获取数据
我正在向私有API(托管ITOP)提出HTTPS请求,我得到了一个响应,但是我得到cors tourment不允许
错误,因此我的JavaScript程序无法使用响应内容。
我应该拥有CORS授权,
请求是post
,用fetch制成的,没有前(options
)请求()请求(fetch为我的其他人单独使用它们获取
API请求,但不在此处)
也有一些服务器响应时间很长,firefox(〜2s),但似乎不会更改任何内容
I'm making HTTPS request to a private API (hosted Itop), I get an response but I get CORS Multiple Origin Not Allow
error so my JavaScript program can't use the response content.
I'm supposed to have CORS authorization
The requests are POST
, made with fetch, there isn't preflight (OPTIONS
) request made before (fetch did them alone for my other GET
API request but didn't here)
Also some server response time is long for firefox (~2s) but it don't seems to change anything
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在同一响应中,不允许发送多个
access-control-wall-wall-oligin
标题或一个标头中的多个起源。在评论中,您描述了两个响应中的两个相同的access-control-allow-oferigin
标题。甚至不允许两个相同的起源。删除后端代码中的一个标头。It's not allowed to send multiple
Access-Control-Allow-Origin
headers or multiple origins in one header in the same response. In the comments, you described two sameAccess-Control-Allow-Origin
headers in one response. Even two same origins aren't allowed. Remove one header in the backend code.Firefox是确定此问题的最佳浏览器,
您可以遵循此路径来解决此问题。
当您从Frontend发送请求时,然后响应将来自后端。但是,不允许浏览器对javaScript进行讨论。这是CORS错误。
1.打开您的后端,然后创建一个软件包调用CorsFilter。
2。然后创建一个过滤器servlet
3。粘贴此代码
corsfilter
firefox is the best browser to identify this issue,
you can fix this issue by following this path.
when you sending a request from frontend,and then response will come from backend. but browser is not allowed to aceess to javascript. this is the cors error.
1.open ur backend, then create a package call CorsFilter.
2. and then create a filter servlet
3. paste this code
CorsFilter