# How to use mitdump as HTTP Monitor

**URL:** <https://discourse.mitmproxy.org/t/how-to-use-mitdump-as-http-monitor/586>\
**Category:** help\
**Created:** [August 9, 2017, 2:11pm UTC](https://discourse.mitmproxy.org/t/how-to-use-mitdump-as-http-monitor/586 "2017-08-09T14:11:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![artur](https://avatars.discourse-cdn.com/v4/letter/a/53a042/32.png) [@artur](https://discourse.mitmproxy.org/u/artur)\
**Post date:** [August 9, 2017, 2:11pm UTC](https://discourse.mitmproxy.org/t/how-to-use-mitdump-as-http-monitor/586/1 "2017-08-09T14:11:32Z")

</div>

Hello,

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?

regards,  
Artur

---

<div class="post-metadata">

**Author:** ![ujjwal96](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mitmproxy.org/ujjwal96/32/111_2.png) [@ujjwal96](https://discourse.mitmproxy.org/u/ujjwal96)\
**Post date:** [August 9, 2017, 8:45pm UTC](https://discourse.mitmproxy.org/t/how-to-use-mitdump-as-http-monitor/586/2 "2017-08-09T20:45:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![artur](https://avatars.discourse-cdn.com/v4/letter/a/53a042/32.png) [@artur](https://discourse.mitmproxy.org/u/artur)\
**Post date:** [August 9, 2017, 10:45pm UTC](https://discourse.mitmproxy.org/t/how-to-use-mitdump-as-http-monitor/586/3 "2017-08-09T22:45:05Z")

</div>

> [@ujjwal96](#):
>
> mitmdump -m reverse:SPEC --set keep\_host\_header=true

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: dev.sh 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/ **init**.py”, line 658, in \_build\_master  
ws.require( **requires** )  
File “/home/mmp/mitm/src/mitmproxy/venv/lib64/python3.4/site-packages/pkg\_resources/ **init**.py”, line 972, in require  
needed = self.resolve(parse\_requirements(requirements))  
File “/home/mmp/mitm/src/mitmproxy/venv/lib64/python3.4/site-packages/pkg\_resources/ **init**.py”, 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/ **init**.py”, line 3049, in   
@\_call\_aside  
File “/home/mmp/mitm/src/mitmproxy/venv/lib64/python3.4/site-packages/pkg\_resources/ **init**.py”, line 3033, in \_call\_aside  
f(\*args, \*\*kwargs)  
File “/home/mmp/mitm/src/mitmproxy/venv/lib64/python3.4/site-packages/pkg\_resources/ **init**.py”, 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/ **init**.py”, 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/ **init**.py”, 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/ **init**.py”, 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

---

<div class="post-metadata">

**Author:** ![ujjwal96](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mitmproxy.org/ujjwal96/32/111_2.png) [@ujjwal96](https://discourse.mitmproxy.org/u/ujjwal96)\
**Post date:** [August 10, 2017, 1:05pm UTC](https://discourse.mitmproxy.org/t/how-to-use-mitdump-as-http-monitor/586/4 "2017-08-10T13:05:55Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![artur](https://avatars.discourse-cdn.com/v4/letter/a/53a042/32.png) [@artur](https://discourse.mitmproxy.org/u/artur)\
**Post date:** [August 10, 2017, 11:30pm UTC](https://discourse.mitmproxy.org/t/how-to-use-mitdump-as-http-monitor/586/5 "2017-08-10T23:30:05Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![ujjwal96](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mitmproxy.org/ujjwal96/32/111_2.png) [@ujjwal96](https://discourse.mitmproxy.org/u/ujjwal96)\
**Post date:** [August 11, 2017, 3:06am UTC](https://discourse.mitmproxy.org/t/how-to-use-mitdump-as-http-monitor/586/6 "2017-08-11T03:06:36Z")

</div>

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

> **[pyenv/pyenv-installer](https://github.com/pyenv/pyenv-installer#installation--update--uninstallation)**
>
> This tool is used to install \`pyenv\` and friends. Contribute to pyenv/pyenv-installer development by creating an account on GitHub.

  

> <https://askubuntu.com/questions/865554/how-do-i-install-python-3-6-using-apt-get/865644#865644>
