Inline script loaded several times with mitmproxy/mitmdump log option

Hello, i’m facing an issue with mitmproxy/mitmdump v0.18.1 and v0.18.2 (everything was working fine with v0.17.1).

When you run this command:
mitmproxy --script ./ --eventlog

You surf on, click on “Mon compte ameli”, the page is well displayed (stripping has been well done)

Now run:
mitmproxy --script ./ --eventlog -a test.log
You surf on, click on “Mon compte ameli”, we have a HttpReadDisconnect(‘Server disconnected’,) issue because the script is reloaded, so the variable secure_hosts is reinitialized (empty).

So this behavior happens only when mitmproxy (or mitmdump) is writing to file. This issue has been reproduced with the inline script too in addition to

I created an issue for that, so any help should be appreciated or if this behavior has already been identified ?


Seems things are working with git master v0.19

Thanks in advance,


this reloading comes from the fact that the script and the log output reside in the same directory. The change of a file in the directory triggers the script reloading.


Hello Michael,

Thanks for your answer, it seems that i do not have this issue with git master (v0.19). it’s quite weird to reload every scripts due to a directory update. By the way i changed my directories structure.


Yes, sorry about the current behaviour - it is not quite optimal in some cases. We plan to change it to reload on changes to *.py files only:

OK great thanks Maximilian