CORS policy: Response to preflight request doesn't pass access control

Hi @software_developer20 and community members,

Currently I’m trying to develop some small app on plain JS, which suppose to take some data from DHIS (2.40), process it and send to external server. Here is the header

despite I have enlisted destination URL as a CORS whitelist, I still can’t get throw and receiving an error messages:

Access to fetch at ‘https://abc.com/records/batch’ from origin ‘https://bcd.com’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: Redirect is not allowed for a preflight request.

Any suggestions how overcome and resolve this situation? Basically I need to disable
strict-origin-when-cross-origin and be able to get response on preflight stage for POST method.

Thank you very much

Regards,
Ulanbek

Try looking at the following:

The HTTP response status, especially 301, 302, 307, or 308.

The Location response header to identify the redirect destination.

Whether the frontend is calling the correct HTTPS API URL.

Whether the server handles OPTIONS requests before authentication and redirect middleware.

Whether the server returns appropriate Access-Control-Allow-Origin, Access-Control-Allow-Methods, and Access-Control-Allow-Headers headers.

@Ulanbek, the DHIS2 URL is set in the external server’s CORS whitelist right?

Yes, @claude.mamo , it was done as a first of all…

@King_Wells I have requested if there is any redirection. thank you for your idea