In my CEF Application
I register a custom scheme handler for the scheme backend://
. As done in scheme_handler example
I call in every process (Rendere Process and Browser-Process)
AddCustomScheme
:
void registerCustomSchemes(CefRawPtr<CefSchemeRegistrar> registrar)
{
for(auto& scheme : getCustomSchemes()) // "backend" and "client"
{
registrar->AddCustomScheme(scheme,
true /* is standart*/,
false /* is local */,
false /* is display_isolated */,
true /* is secure */,
true /* is cors enabled*/,
false /* is_csp_bypassing*/);
}
}
The client://
scheme has also a handler installed.
When I dont call AddCustomScheme
with both client
and backend
. The backend://
handler works (as well as the client
handler), but I dont receive any post request data (I send some binary data).
When I use the AddCustomScheme
the scheme handlers for client
and backend
are no more triggered.
How should I setup the custom handler backend
such that it receivs post data requests? I also tried to play around with the bools in AddCustomHandler
which did not help.
You are attempting a cross-origin
XmlHttpRequest
(XHR). You need to configure Cross-origin resource sharing (CORS). Look atCefAddCrossOriginWhitelistEntry
.WebKit
does not passPOST
data to the request for synchronous XHRs executed on non-HTTP schemes. See theAreMethodAndURLValidForSend()
checks inXMLHttpRequest::send() in third_party/WebKit/Source/core/XMLHttpRequest.cpp
.If you need to use XHR
POST
requests you should register your custom handler using theHTTP
orHTTPS
protocol. Since this is an intentionalWebKit
design feature it is likely not changed forCEF3
.