Welcome Guest Search | Active Topics | Sign In | Register

unexpected CORS Violation in 21.0.18 Options
James
Posted: Friday, February 5, 2021 2:09:15 PM
Rank: Advanced Member
Groups: Member

Joined: 2/11/2015
Posts: 122
In our application we have been injecting a pair of headers into requests initiated by the browser by adding a BeforeRequestLoad event handler and adding the headers to the request.

Starting in the latest version of EO.WebBrowser (21.0.18) this no longer works works when the request is a cross origin request.

I've been trying to understand why this no longer works, and one thing I've come up with is that the rules about when extra headers can be added has changed, however I'm finding it hard to verify this information and was hoping someone could provide some additional confirmation?

I did suspect that maybe the browser was failing to send preflight checks correctly for these requests because of how we are injecting the headers, but the preflight's are being sent correctly and we are getting a response that indicates the headers are not allowed.
Quote:

Access to XMLHttpRequest at 'http://domain1/' from origin 'http://domain2' has been blocked by CORS policy: Request header field x-customer-header is not allowed by Access-Control-Allow-Headers in preflight response.


Any information you might have or even verification that this is due to new cors requirements in the browser would be greatly appreciated.
eo_support
Posted: Tuesday, February 9, 2021 11:32:39 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Hi,

This is just part of the CORS Preflight mechanism, where a server that understands CORS protocol can dictate what request header entry it would accept. The browser engine would then enforce this and reject any request that does not meet the rule stated by the server (from a preflight request response). I am not sure how it used to work though. You can find more information about this header entry here:

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.