node-http-mitm-proxy
node-http-mitm-proxy copied to clipboard
error when using forceSNI
Hi, I have the same problem as #64, I tried to use forceSNI to have a single https server for all hosts which uses only one port for listening.
proxy.listen({ port: 85, timeout : 120000, forceSNI: true }, (error) => { console.log(error); });
This didn't work for me, I have this error :
net.js:993
throw new ERR_INVALID_ARG_TYPE('options.port',
^
TypeError [ERR_INVALID_ARG_TYPE]: The "options.port" property must be one of type number or string. Received an instance of Object
at lookupAndConnect (net.js:993:13)
at Socket.connect (net.js:972:5)
at Object.connect (net.js:182:17)
at makeConnection (/root/MITM/node_modules/http-mitm-proxy/lib/proxy.js:392:20)
at /root/MITM/node_modules/http-mitm-proxy/lib/proxy.js:376:16
at Object.item.task (/root/MITM/node_modules/semaphore/lib/semaphore.js:40:29)
at Object.take (/root/MITM/node_modules/semaphore/lib/semaphore.js:51:9)
at Proxy._onHttpServerConnectData (/root/MITM/node_modules/http-mitm-proxy/lib/proxy.js:366:9)
at Object.onceWrapper (events.js:418:26)
at Socket.emit (events.js:311:20) {
code: 'ERR_INVALID_ARG_TYPE'
}
Please help !
replace ln 673 in proxy.ts with the following:
port: self.sslServers[wildcardHost].port
you can also just change the proxy.js in the http-mitm-proxy module/lib directory (line 374)
This happens to me even when I don't enable forceSNI
.
@chribro88 I'm not familiar with this lib and didn't really dig into the codebase, but would you say this should be a permanent fix ? Why does it happen ? If you'd like to create a PR I'll let you do it, else, if I'm provided with some guidance I can file one.
cc @joeferner