Is https://localhost:8080 expected to work?


So the basic question is if http_proxy=http://localhost:8080; https_proxy=https://localhost:8080 is supposed to work (specifically for the https part)?

Here is how I can reproduce the problem:

  1. Start mitmproxy (`./mitmproxy``)
  2. Run this node.js code:
    var request = require('request');
    request.debug = true;
      method: 'GET',
      uri: '',
      //proxy: 'http://localhost:8080',  // Works
      proxy: 'https://localhost:8080'  // Fails
  3. The request hangs indefinitely
Any other comments? What have you tried so far?

Here is the event log with debug level turned on:

Using http://localhost:8080:

info: clientconnect
debug: ::ffff: Set new server address:
debug: ::ffff: Establish TLS with client
debug: ::ffff: request
  -> Request(GET /)
debug: ::ffff: serverconnect
  -> ('', 443)
debug: ::ffff: Establish TLS with server
debug: ::ffff: ALPN selected by server: -
debug: ::ffff: response
  -> Response(200 OK, text/html; charset=utf-8, 56.75k)
debug: ::ffff: serverdisconnect
  -> ('', 443)
info: clientdisconnect

Using https://localhost:8080

info: clientconnect
debug: ::ffff: Establish TLS with client
debug: ::ffff: Set new server address:
debug: ::ffff: Establish TLS with client

At this point, it just hangs indefinitely.

I’m not sure if this is really a valid scenario for mitmproxy. My only motivation to try this out was because I’ve seen environments where http_proxy points to http://proxy:3128 and https_proxy points to https://proxy:3128 and was testing the same setup with mitmproxy.


Hi, we currently don’t support TLS over TLS, which would be required for what Chromium is calling “Secure Web Proxy”. We do have plans to fix this, but for your specific use case (proxy running on localhost) it should not matter.



Thank you, @mhils, for the answer. I wasn’t sure if it was mitmproxy or the request npm module that was the problem. This clears it up.