New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
webRequest.onBeforeSendHeaders callback response requestHeaders not optional in 7.0.0 #20751
Comments
I am trying to connect to a local WebSocket server. I was on electron I am using the following code session.defaultSession.webRequest.onBeforeSendHeaders(
{
urls: [
'*://*/*',
],
},
(details, callback) => {
let reqHeaders = Object.assign({}, details.requestHeaders, {
Origin: null,
});
callback({
cancel: false,
requestHeaders: reqHeaders,
});
}
); |
@sandeep1995 I'd suggest trying 7.1.2+, see #20923 for details. |
@vladimiry on 7.1.2,
|
I am still not able to connect to a local WebSocket server from the renderer as I could not modify the I tried |
@sandeep1995 origin header is being successfully modified here https://github.com/vladimiry-playground/electron-quick-start-cors-issue/blob/357c37682d5f881d76a7be94c995edc7d22c35ac/main.js#L70 using electron@v7.1.2 |
@vladimiry Maybe that is because you are trying to modify for an XHR request. According to my investigation, it seems like it's a bug on the Chromium side. |
Got it, so I overlooked the websockets use. |
I filed a similar issue for Electron v8 and |
According to my tests with Electron Fiddle, version |
NOTE: the workaround There is an other workaround |
Preflight Checklist
Issue Details
Expected Behavior
Additional headers sent without changes as documented
https://github.com/electron/electron/blob/v7.0.0/docs/api/web-request.md
Actual Behavior
Additional headers removed and not sent to server.
To Reproduce
run following snippet:
https://gist.github.com/binux/3c2023793e1bf1ff03a8fcb24b026162
Additional Information
Workaround will be change callback as
callback({ requestHeaders: details.requestHeaders })
.The text was updated successfully, but these errors were encountered: