map-local not working in 5.3.0
See original GitHub issueProblem Description
We use mitmproxy locally to replay backend queries made from frontend. After updating from 5.2 to 5.3.0 every command that has the --map-local options seems to work otherwise correctly but mitmproxy seems to completely ignore the --map-local part when replaying. On startup mitmproxy does validate that the local resource is present so it doesn’t completely ignore the option but it never actually seems to use it. The replay command that we use also has flows that are replayed and that part does work as intended. But even if we leave the flows out of the command and only use --map-local command the local resource is not served.
Steps to reproduce the behavior:
- Make a local resource file (local.json) and, optionally, prepare a flows file (mitmproxy-flows)
- Choose a server you are trying to mimick with replay
- Run command
mitmdump --mode reverse:http://localhost:8910/ -S mitmproxy-flows --server-replay-nopop --server-replay-refresh --listen-port 7777 --map-local "|~m GET|localhost:8910/api/resource|local.json"
- Try to go to URL http://localhost:7777/api/resource
System Information
WORKING version info is:
Mitmproxy: 5.2 binary
Python: 3.7.8
OpenSSL: OpenSSL 1.1.1g 21 Apr 2020
Platform: Darwin-19.6.0-x86_64-i386-64bit
(note that I used the macOS binaries here when testing with 5.2 but it was also working with 5.2 installed with homebrew)
NOT WORKING version info is:
Mitmproxy: 5.3.0
Python: 3.9.0
OpenSSL: OpenSSL 1.1.1h 22 Sep 2020
Platform: macOS-10.15.7-x86_64-i386-64bit
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
This is fixed on master now, updated binaries should appear at https://mitmproxy.org/downloads/#branches/master/ in the next 15 minutes. 😃
I confirm that the fixed version is working! Thanks!
And you are correct in that there are alternatives to homebrew. Thankfully. What I meant was that on the mitmproxy website the homebrew version is the advertised way to use mitmproxy and this case just showed that it is also the most fragile way to use mitmproxy (unable to change the version and you are stuck with what it gives you). Someone who is not tech-savvy might reject mitmproxy as an option if it does not work the way intended without looking for alternative ways to use the application. But this is not your fault and was just a sidetracked comment. So nevermind that and the main point is that the bug is fixed and will work in the future 👍