仅一名用户的随机CORS飞行前问题 [英] random CORS preflight problem only for one user
问题描述
我有一个使用angular 8开发的应用程序.它使用httpClient与后端进行通讯,并使用自动化.
I have an application developed with angular 8. It uses httpClient to comunicate with the backend and uses autentication.
我有一个奇怪的问题,经过长期研究我可以找到解决方案.
I have a weird problem I can find the solution after long research.
我的用户遍布世界各地,只有其中一个用户失败.
I have users all over the world, and it only fails for one of them.
对于一个特定用户,并且(显然)是随机的,由于预检CORS问题,至少在控制台中,API被拒绝:
For one particular user and (apparently) randomly, the APIs are rejected, and at least as it's said in the console, because of a preflight CORS issue:
Access to XMLHttpRequest 'myAPIip.com" from origin 'myip.com' 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
在控制台中,出现错误:
In the console, there is the error:
Error: Uncaught (in promise): EmptyError: no elements in sequence↵
以及所有这些堆栈跟踪.
and all this stack trace.
没有鞭策.
有人面对类似的情况吗?会发生什么?
Does anybody face similar situation? what can be happening?
推荐答案
FWIW,我们也面临着类似的问题.我们最终将其范围缩小到包含unicode字符的用户信息.例如,收到错误的用户的姓氏类似于:
FWIW, we were also facing a similar problem. We eventually narrowed it down to the user info containing a unicode character. For example, the user getting the error had a last name similar to:
- François
- Sørina
- 努涅斯(Nuñez)
我们使用的HTTP代理无法处理此类unicode字符.希望这对以后的人有所帮助.
The HTTP proxy that we were using couldn't handle such unicode characters. Hope this helps someone in the future.
这篇关于仅一名用户的随机CORS飞行前问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!