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?