Identify failed Pre-flight request ( CORS issues )

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Identify failed Pre-flight request ( CORS issues )

Postby Satrajit » Mon Mar 22, 2021 11:29 am

Whenever the browser makes a preflight request (HTTP OPTIONS call) in certain cases and If the response of the preflight request fails the protocol checks ( no response / response not as expected ), the actual request ( GET / POST ) is not made and the XHR errors out with status code 0 in such cases.

Those cases return status code as 0. Is there any way to identify preflight request failure scenarios or any API to capture the preflight request failure (as there can be other reasons for getting the status code as 0) ?
Main motive is to differentiate other errors with the preflight failures.
Satrajit
Mentor
 
Posts: 87
Joined: Wed Jan 09, 2019 6:11 am

Re: Identify failed Pre-flight request ( CORS issues )

Postby Satrajit » Tue Mar 23, 2021 4:24 am

@magreenblatt any API that can be used for this cause?
Satrajit
Mentor
 
Posts: 87
Joined: Wed Jan 09, 2019 6:11 am

Re: Identify failed Pre-flight request ( CORS issues )

Postby magreenblatt » Tue Mar 23, 2021 9:16 am

Are there any error messages written to the JS console?
magreenblatt
Site Admin
 
Posts: 12402
Joined: Fri May 29, 2009 6:57 pm

Re: Identify failed Pre-flight request ( CORS issues )

Postby Satrajit » Thu Mar 25, 2021 1:56 am

Access to XMLHttpRequest at 'https://xxx/config.json' from origin 'http://localhost:8000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.

This is the error message on JS console.
The status code returned is 0

But is there any way for CEF to differentiate this preflight request error ?
Satrajit
Mentor
 
Posts: 87
Joined: Wed Jan 09, 2019 6:11 am

Re: Identify failed Pre-flight request ( CORS issues )

Postby magreenblatt » Thu Mar 25, 2021 9:26 am

Not that I'm aware of. See here for background.
magreenblatt
Site Admin
 
Posts: 12402
Joined: Fri May 29, 2009 6:57 pm


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot] and 20 guests