node-http-mitm-proxy icon indicating copy to clipboard operation
node-http-mitm-proxy copied to clipboard

upgradeReq is undefined

Open normanzb opened this issue 7 years ago • 5 comments

when use MITM proxy against github, it throws exception says ctx.clientToProxyWebSocket.upgradeReq is undefined and hence "Cannot read property 'url' of undefined"

I think it is to do with upgradeReq no longer exist in websocket 3.0:

https://github.com/websockets/ws/issues/1114

as the version number in package for ws is 3.2.0, I guess it explains why.

normanzb avatar Nov 30 '17 10:11 normanzb

it turns out the issue only happen in v0.6.0 tag https://github.com/joeferner/node-http-mitm-proxy/blob/v0.6.0/lib/proxy.js

can you please release a new version with the fix?

normanzb avatar Nov 30 '17 10:11 normanzb

Same error here

http-mitm-proxy\lib\proxy.js:583
  if (ctx.clientToProxyWebSocket.upgradeReq.url == '' || /^\//.test(ctx.clientToProxyWebSocket.upgradeReq.url)) {
                                            ^

TypeError: Cannot read property 'url' of undefined

r3verser avatar Dec 01 '17 17:12 r3verser

I get this as well

acklenx avatar Dec 10 '17 21:12 acklenx

normanzb I read the linked material and applied "the fix" somewhat blindly. It works on my machine. Can you take a look? (this project may be dead)

acklenx avatar Dec 10 '17 22:12 acklenx

@acklenx all you need to do is use the code from master branch of this repository, this is only an issue with v0.6.0, the author marked it with wrong version of ws.

normanzb avatar Dec 14 '17 16:12 normanzb