mitmproxy Cheatsheet - Packet Capture & Debugging Reference
Browser DevTools only sees what your own browser sent; to see other apps' HTTPS traffic you need a MITM proxy. This reference covers mitmproxy/mitmdump/mitmweb modes and ports, filter expressions, flow interception/editing, addon scripts, and the CA-cert install that decrypts HTTPS. Use it when debugging a mobile app, an old client, or a scheduled job that doesn't go through the browser. After reading you can capture, filter and even rewrite live API calls.
Startup & Modes 7
mitmproxyStart the interactive UI
mitmwebStart the Web UI
mitmdumpCommand-line mode (like tcpdump)
mitmproxy -p 8080Specify a port
mitmproxy --mode transparentTransparent proxy mode
mitmproxy --mode upstream:http://proxy:8080Upstream proxy mode
mitmproxy --listen-host 0.0.0.0Listen on all addresses
Filter Expressions 11
~u example.comURL contains example.com
~d example.comDomain contains example.com
~m GETMethod is GET
~c 200Status code 200
~h "Content-Type: json"Header contains
~b "error"Request or response body contains
~qRequests only
~sResponses only
~t "text/html"Content-Type matches
~u example.com & ~m GETCombined filter (AND)
~u example.com | ~u test.comCombined filter (OR)
Interactive Operations 10
?View help
qQuit
eEdit request/response
rReplay request
wSave to file
WStream-save to file
/Search
nCreate new request
IIntercept mode toggle
FSet focus-follow
Scripting & Modification 5
mitmproxy -s script.pyLoad a script
mitmdump -s script.py -w outfileScript + save traffic
mitmproxy --set blocklist=example.comBlock a domain
mitmproxy --set modify_headers="~q|Host:example.com"Modify request headers
mitmproxy --set modify_body="~q|regex|replace"Modify request body
HTTPS Certificates 4
mitmproxy --set ssl_insecure=trueSkip upstream cert verification
Visit http://mitm.it to download the certDownload the CA cert on the client
~/.mitmproxy/mitmproxy-ca-cert.pemCA certificate path
security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain cert.pemInstall cert on macOS
Tips
- HTTPS capture needs the mitmproxy CA cert installed on the client.
- Transparent proxy mode needs iptables or routing; good for mobile capture.
- Scripts are written in Python and can implement complex request modifications.
Official References
Each command links to its official documentation below, so you can verify the latest usage and read deeper.
Maintained by LaoHand
Publicly updated on Jul 21, 2026, continuously proofread against official docs.
Contact Us
Wrong command or description? Send us corrections, business inquiries or product feedback by email.
Contact Us