I was connecting my app with a REST API in which some operations return response redirects. So I got the error: "Redirects form [url] has been blocked by CORS policy. Request requires preflight, which is disallowed to follow cross-origin redirect."
Is it possible to create a new zone (besides angular zone and default zone), catch the error and execute the request manually?
Or... any good idea? The server sometimes return redirect responses.
UPDATE:
Flow:
- I request the url /foo.
- CORS send a OPTIONS request to /foo
- When step 2 return ok, then send GET to /foo
- The server returns a redirect to /bar
The current flow is:
- The browser throws an exception
The flow I want to get:
- Catch the exception with zone
- Read the url to redirect and launch another GET request to /bar
I think using Zone is possible catch the browser exception. The question is HOW?
I'm not sure if I launch an http request out of angular zone and if everything can become unstable. Do you think this could be possible to do?