I'm trying to use the Chrome DevTools Protocol
(CDP
) to intercept web requests and modify them.
The problem is that I need to modify the headers of a WebSocket request. Is this possible?
I can modify the headers of "normal" requests easily by first sending messages:
Network.enable
Network.setRequestInterception
and then listening for the Network.requestIntercepted
message and replying with an appropriate Network.continueInterceptedRequest
message.
However, Network.requestIntercepted
does not get called for WebSockets. I can listen for Network.webSocketWillSendHandshakeRequest
but this only lets me read the request, I don't see any way to modify it.
Is there a way to do this, or is this impossible at the moment?
The Chrome DevTools Protocol provides APIs to instrument, inspect, debug, and profile Chromium-based browsers. The Chrome DevTools Protocol is the foundation for the Microsoft Edge DevTools. Use the Chrome DevTools Protocol for features that aren't implemented in the WebView2 platform.
After further testing of all possible combinations, I came to the conclusion that this cannot be done, unfortunately.
If I'm wrong, feel free to correct me and I'll accept your answer and delete this one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With