Steps to reproduce the problem:
- Docker pull mitmproxy container from docker hub
- Run docker container as:
docker run --rm -it -p 8080:8080 mitmproxy/mitmproxy mitmdump --set ssl_insecure=true mode=upstream:https://158.69.243.155:8888
- Run curl command:
curl -vvvv -k --proxy 127.0.0.1:8080 https://whatsmyip.net
Get this output from curl:
* Rebuilt URL to: https://whatsmyip.net/ [23/391]
* Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
* Establish HTTP proxy tunnel to whatsmyip.net:443
> CONNECT whatsmyip.net:443 HTTP/1.1
> Host: whatsmyip.net:443
> User-Agent: curl/7.47.0
> Proxy-Connection: Keep-Alive
>
< HTTP/1.1 200 Connection established
<
* Proxy replied OK to CONNECT request [12/391]
* found 148 certificates in /etc/ssl/certs/ca-certificates.crt
* found 597 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* SSL connection using TLS1.2 / ECDHE_RSA_AES_128_GCM_SHA256
* server certificate verification SKIPPED
* server certificate status verification SKIPPED
* common name: whatsmyip.net (matched)
* server certificate expiration date OK
* server certificate activation date OK
* certificate public key: RSA
* certificate version: #3
* subject: CN=whatsmyip.net
* start date: Wed, 05 Sep 2018 12:05:18 GMT
* expire date: Sun, 06 Sep 2020 12:05:18 GMT
* issuer: CN=mitmproxy,O=mitmproxy
* compression: NULL
* ALPN, server accepted to use http/1.1
> GET / HTTP/1.1
> Host: whatsmyip.net
> User-Agent: curl/7.47.0
> Accept: */*
>
< HTTP/1.1 502 Bad Gateway
< Server: mitmproxy 4.0.4
< Connection: close
< Content-Length: 367
< Content-Type: text/html
<
<html>
<head>
<title>502 Bad Gateway</title>
</head>
<body>
<h1>502 Bad Gateway</h1>
<p>ProtocolException('Server connection to (\'whatsmyip.net\', 443) failed: Error connecting to "whatsmyip.net": [Errno -3] Try again',)</p>
</body>
* Closing connection 0
I also tried to run docker container with commands provided in the how to on docker hub, but get same 502 bad gateway error.
I mean commands like this:
docker run --rm -it -p 8080:8080 mitmproxy/mitmproxy mitmdump --set ssl_insecure=true
Any suggestions?