random CORS preflight problem only for one user

Viewed 1802

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.

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.

There is no firewal.

Does anybody face similar situation? what can be happening?

3 Answers

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

The HTTP proxy that we were using couldn't handle such unicode characters. Hope this helps someone in the future.

Probably you have an error in routing or RxJS. Link: EmptyError: no elements in sequence

But also i saw this error in some old version browser, which didn't provide Access-Control-Allow-Origin headers. Check user full request.

Check whether your application is blocking certain IP addresses. Might be the issue.

Related