How to use mitdump as HTTP Monitor


I am trying to use mitdump as a simple HTTP monitor that will log away all request and headers which are of interest for me. Running in reverseproxy mode and using a small python script everthings looks perfect…
But then the mitdump rewrite Host Header feature gives me headache. I need the requests to be passed on without any modification. Particularly the Host header needs to be untouched as the application is sensitive for it.
In the code i found the keep_host_header parameter, which seems perfectly for me. But it is not accepted by mitmdump.
Can anybody suggest a solution?


Hi, which version are you using?
mitmdump -m reverse:SPEC --set keep_host_header=true should work on git-master

Thank you for the help.
Sounds very much like what I need … but I can not use it. I am using the latest prebuild release v2.0.2 and it does not provide the parameters. And I am not able to use master. When I try to build from source following the instructions: runs fine, but after activating the virtual environment I get an error …

(venv) (1)linux-vm: ~/mitm/src/mitmproxy
[master=] > mitmdump --shortversion
Traceback (most recent call last):
File “/home/mmp/mitm/src/mitmproxy/venv/lib64/python3.4/site-packages/pkg_resources/”, line 658, in _build_master
File “/home/mmp/mitm/src/mitmproxy/venv/lib64/python3.4/site-packages/pkg_resources/”, line 972, in require
needed = self.resolve(parse_requirements(requirements))
File “/home/mmp/mitm/src/mitmproxy/venv/lib64/python3.4/site-packages/pkg_resources/”, line 863, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (idna 2.6 (/home/mmp/mitm/src/mitmproxy/venv/lib/python3.4/site-packages), Requirement.parse(‘idna<2.6,>=2.5’), {‘requests’})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/mmp/mitm/src/mitmproxy/venv/bin/mitmdump”, line 6, in
from pkg_resources import load_entry_point
File “/home/mmp/mitm/src/mitmproxy/venv/lib64/python3.4/site-packages/pkg_resources/”, line 3049, in
File “/home/mmp/mitm/src/mitmproxy/venv/lib64/python3.4/site-packages/pkg_resources/”, line 3033, in _call_aside
f(*args, **kwargs)
File “/home/mmp/mitm/src/mitmproxy/venv/lib64/python3.4/site-packages/pkg_resources/”, line 3062, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File “/home/mmp/mitm/src/mitmproxy/venv/lib64/python3.4/site-packages/pkg_resources/”, line 660, in _build_master
return cls._build_from_requirements(requires)
File “/home/mmp/mitm/src/mitmproxy/venv/lib64/python3.4/site-packages/pkg_resources/”, line 673, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File “/home/mmp/mitm/src/mitmproxy/venv/lib64/python3.4/site-packages/pkg_resources/”, line 858, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The ‘idna<2.6,>=2.5’ distribution was not found and is required by requests

This is because -

idna released idna 2.6
we depend on both cryptography and requests, which both depend on idna
cryptography’s dependency: >=2.1
request’s dependency: >=2.5, <2.6
pip… just installs 2.6 because cryptography is listed before requests

This should be fixed on the master now. Can you pull and try again?

Thanks, yes the idna issue is gone - but I have a new one instead now
Now Pythons 3.5 is required. On the maschine where I want mitmdump to run only 3.4 is available and I do not have root privilegies.
I tried to find a description how to build the standalone portable binaries - but could not find anything. Do you have a hint?

You can use pyenv to manage python versions. It doesn’t require root privileges and is easy to use.