1

I have a mitmproxy instance running on port 2222. I want to put it behind a reverse proxy (like Nginx or Caddy), so I can use it as mitmproxy.tld. It seems that mitmproxy can't be accessed by anything other than 127.0.0.1 or localhost, though I'm not sure about this.

curl -x http://mitmproxy.tld:80 google.com -v gives me a 500 Internal Server Error


I have something that sort of works ---

stream {
    map $ssl_preread_server_name $port {
            hostnames;
            proxy.history.* 2222;
            default '';
        }
server {
    listen 127.0.0.1:1080;
    ssl_preread on;

    proxy_pass 127.0.0.1:2222;
}

The problem is that there's no variable for the proxy host name, so I can't check if people are accessing the proxy from the right domain.

DavidPostill
  • 162,382

1 Answers1

0

By default mitmproxy and mitmweb only listen on localhost/127.0.0.1 but you can specify the host/interface it should listen on, for example if it should listen on all available IPv4 interfaces use 0.0.0.0:

mitmproxy --listen-host 0.0.0.0
mitmweb  --listen-host 0.0.0.0

If you want additionally also listen on IPv6 use ::

mitmproxy --listen-host ::
mitmweb  --listen-host ::

mitmdump by default already listens on all IPv4 and IPv6 interfaces.

Robert
  • 8,055