mitmproxy — The Interactive HTTPS Proxy for Debugging and Reverse Engineering
mitmproxy is a free, open-source interactive HTTP/HTTPS/HTTP2/WebSocket proxy for developers, researchers, and security professionals. Inspect, modify, replay, and replay traffic on the fly — from the terminal, a web UI, or Python scripts.
What it is
mitmproxy is a free, open-source interactive HTTP/HTTPS/HTTP2/WebSocket proxy. It sits between your device and the internet, decrypts HTTPS traffic (after CA certificate installation), and displays every request and response. You can inspect, modify, and replay traffic on the fly.
mitmproxy serves three audiences: mobile developers inspecting app traffic, QA teams simulating broken or slow networks, and security researchers reverse-engineering protocols. It ships with three interfaces: a terminal TUI (mitmproxy), a web dashboard (mitmweb), and a headless capture tool (mitmdump).
How it saves time or tokens
Without a proxy, debugging API calls requires adding logging to application code, rebuilding, and redeploying. mitmproxy lets you see real traffic instantly without code changes. The Python scripting API means you can write custom interceptors -- blocking certain requests, injecting headers, or modifying response bodies -- in a few lines. For AI development workflows, this is particularly useful when debugging LLM API calls to see exact token usage and response timing.
How to use
- Install mitmproxy:
brew install mitmproxy(macOS) orpip install mitmproxy. - Launch the proxy: run
mitmproxyfor terminal UI,mitmwebfor browser UI, ormitmdump -w traffic.mitmfor headless capture. - Configure your device or browser to use
127.0.0.1:8080as HTTP proxy. - Install the CA certificate by visiting
http://mitm.itwhile the proxy is running.
Example
# custom_script.py -- log all API calls to OpenAI
from mitmproxy import http
def response(flow: http.HTTPFlow):
if 'api.openai.com' in flow.request.pretty_host:
print(f'[OpenAI] {flow.request.method} {flow.request.path}')
print(f' Status: {flow.response.status_code}')
print(f' Size: {len(flow.response.content)} bytes')
# Run with the script
mitmdump -s custom_script.py
Related on TokRepo
- AI tools for security -- explore security and auditing tools curated on TokRepo.
- AI tools for testing -- find tools for API testing and quality assurance.
Common pitfalls
- HTTPS interception requires installing mitmproxy's CA certificate on the client device. Without it, you only see encrypted traffic. Certificate pinned apps will reject the proxy entirely.
- Some applications detect proxy usage and refuse connections. Mobile apps with certificate pinning need additional tools like Frida to bypass.
- Running mitmproxy on a shared network without consent is illegal in most jurisdictions. Use it only on traffic you own or have permission to inspect.
Frequently Asked Questions
Yes. mitmproxy is free and open-source under the MIT license. There are no paid tiers or premium features. The full functionality including terminal UI, web UI, Python scripting, and all protocol support is included.
Yes, after you install its CA certificate on the client device. mitmproxy generates certificates on the fly, signed by its CA, to decrypt and re-encrypt HTTPS traffic. Visit http://mitm.it while the proxy is running to install the certificate.
mitmproxy is the terminal-based interactive UI. mitmweb provides a browser-based web interface. mitmdump is a headless tool for scripted capture and replay. All three share the same proxy engine and support the same Python scripting API.
Yes. Configure the mobile device to use your computer as HTTP proxy, install the mitmproxy CA certificate on the device, and all HTTP/HTTPS traffic flows through mitmproxy for inspection. This works for both iOS and Android.
Yes. mitmproxy can intercept, display, and modify WebSocket messages. Both the terminal UI and web UI show WebSocket frames alongside HTTP traffic in the same session.
Citations (3)
- mitmproxy GitHub— mitmproxy is a free interactive HTTPS proxy with terminal UI, web UI, and Python…
- mitmproxy Documentation— mitmproxy supports HTTP/HTTPS/HTTP2/WebSocket interception
- mitmproxy Concepts— CA certificate installation via mitm.it for HTTPS decryption
Related on TokRepo
Discussion
Related Assets
NAPI-RS — Build Node.js Native Addons in Rust
Write high-performance Node.js native modules in Rust with automatic TypeScript type generation and cross-platform prebuilt binaries.
Mamba — Fast Cross-Platform Package Manager
A drop-in conda replacement written in C++ that resolves environments in seconds instead of minutes.
Plasmo — The Browser Extension Framework
Build, test, and publish browser extensions for Chrome, Firefox, and Edge using React or Vue with hot-reload and automatic manifest generation.