Resourcehandler CORS error

Having problems with building or using the CefSharp .NET binding? Ask your CEF-related questions here. Please ask general usage questions on StackOverflow.

Moderator: amaitland

Resourcehandler CORS error

Postby ray007 » Tue Nov 03, 2020 7:31 am

I'm using CEF through CefSharp, and on upgrade to version 85, my Resourcehandler receiving the data to cache in the filesystem stopped working with a CORS error.
The problem only hit POST requests, all GET requests continue to work fine.

Searching for similar problem on this site I found https://magpcss.org/ceforum/viewtopic.php?f=6&t=17826&p=46838&hilit=cors#p46623, and adding
Code: Select all
settings.CefCommandLineArgs.Add("disable-features", "OutOfBlinkCors");

solved the problem for me. But I guess that's not how thought are supposed to work.

my original Bugreport is on github: https://github.com/cefsharp/Questions-and-Support/issues/60.
ray007
Newbie
 
Posts: 9
Joined: Wed Aug 26, 2015 10:37 am

Re: Resourcehandler CORS error

Postby magreenblatt » Tue Nov 03, 2020 12:15 pm

You should add the 'Access-Control-Allow-Origin' header to your response, as indicated by the error message.
magreenblatt
Site Admin
 
Posts: 10937
Joined: Fri May 29, 2009 6:57 pm

Re: Resourcehandler CORS error

Postby ray007 » Wed Nov 04, 2020 3:28 am

Since I also have a line
Code: Select all
settings.CefCommandLineArgs.Add("disable-web-security", "true");

I do not need to deal with CORS anywhere else - why here?

And why only for POST and not for GET requests?

And I did try enabling CORS for the scheme handler (through the CefSharp API), but didn't get the required headers in the response.
But I think I did see some for GET requests.
ray007
Newbie
 
Posts: 9
Joined: Wed Aug 26, 2015 10:37 am

Re: Resourcehandler CORS error

Postby magreenblatt » Wed Nov 04, 2020 10:12 am

See https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS for background on CORS.

ray007 wrote:Since I also have a line
CODE: SELECT ALL
settings.CefCommandLineArgs.Add("disable-web-security", "true");

I do not need to deal with CORS anywhere else - why here?

The CORS checks for custom schemes are now implemented in CEF (due to OutOfBlinkCors) and we don't check for the disable-web-security flag in that code.
magreenblatt
Site Admin
 
Posts: 10937
Joined: Fri May 29, 2009 6:57 pm

Re: Resourcehandler CORS error

Postby ray007 » Thu Nov 05, 2020 2:54 am

I still don't understand why only the POST requests to the scheme-handler failed and everything else continued to work fine, but things are working again so I'm good.
ray007
Newbie
 
Posts: 9
Joined: Wed Aug 26, 2015 10:37 am


Return to CefSharp Forum

Who is online

Users browsing this forum: No registered users and 1 guest