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

HTTPS doesn't work

Open dfabulich opened this issue 10 years ago • 2 comments

$ node simple_processor.js
https man-in-the-middle proxy server started on port 8000
http proxy server started on port 8080
$ curl -v -k -x http://localhost:8080 https://www.google.com
* Rebuilt URL to: https://www.google.com/
* Hostname was NOT found in DNS cache
*   Trying ::1...
* Connected to localhost (::1) port 8080 (#0)
* Establish HTTP proxy tunnel to www.google.com:443
> CONNECT www.google.com:443 HTTP/1.1
> Host: www.google.com:443
> User-Agent: curl/7.37.1
> Proxy-Connection: Keep-Alive
>
* Proxy CONNECT aborted
* Connection #0 to host localhost left intact
curl: (56) Proxy CONNECT aborted

$ curl -v -k -x http://localhost:8000 https://www.google.com
* Rebuilt URL to: https://www.google.com/
* Hostname was NOT found in DNS cache
*   Trying ::1...
* Connected to localhost (::1) port 8000 (#0)
* Establish HTTP proxy tunnel to www.google.com:443
> CONNECT www.google.com:443 HTTP/1.1
> Host: www.google.com:443
> User-Agent: curl/7.37.1
> Proxy-Connection: Keep-Alive
>
* Proxy CONNECT aborted
* Connection #0 to host localhost left intact
curl: (56) Proxy CONNECT aborted

curl -x http://localhost:8080 http://www.google.com works fine, but I wanted to use this library for its HTTPS support.

dfabulich avatar Aug 04 '15 18:08 dfabulich

Hey @dfabulich I found the same thing happened to me. However, from previous experience I remembered that the event name for the CONNECT request changed from "upgrade" to "connect". On changing the code everything works fine.

andrewfister avatar Sep 23 '15 21:09 andrewfister

@andrewfister worked for me as a charm. Thank you

GeneGenie avatar Jun 06 '17 12:06 GeneGenie