Red and blue railway signal levers in a row inside a signal box, with the article title about writing mitmproxy addons with an LLM
Cover based on a photo by John K Thorne, via Wikimedia Commons, Public Domain Mark 1.0

You can write a mitmproxy addon with an LLM in a minute, and it will look like every example you have seen: a class, a request method, a line that adds a header. Whether it does what you asked is a separate question, and mitmproxy will not always tell you. In our lab, a draft with two misspelled hook names loaded without a single warning and let every out-of-scope request through. A draft that showed the client a 403 for out-of-scope hosts had already sent each of those requests to the server. And the working addon stopped protecting anything the moment we saved a broken edit while mitmdump was running: the proxy kept forwarding traffic with no scope check at all.

This guide runs one small LLM mitmproxy addon through that loop: a scope guard for an authorized test that blocks out-of-scope hosts before a connection is made, tags in-scope requests with a program header, and logs query values that come back verbatim in a response. Every result below came from mitmproxy 12.3.1 on Python 3.13, with twelve requests replayed through mitmdump against lab servers on 127.0.0.1. We checked each hook, attribute and option against the event hooks reference and the mitmproxy.http API docs first. The broken drafts were written for this guide to reproduce mistakes that show up when you ask a model for an AI mitmproxy script. They are not a captured model transcript, and no model was called in the lab. The tool output is the evidence.

Authorized testing only. Point mitmproxy only at applications you own or are engaged to test, and only at traffic from your own clients. The lab used reserved .test hostnames (RFC 6761) mapped to loopback ports; nothing left the machine.

What we ran, and what we didn't

  • mitmproxy 12.3.1 from PyPI (released October 25, 2026), mitmdump in regular proxy mode on 127.0.0.1:18080, with its own confdir so the lab never touched a user CA.
  • Six lab servers in one Python script, each standing in for a hostname: app.lab.test and api.lab.test (in scope), and notlab.test, evillab.test, app.lab.test.evil.test and a catch-all (out of scope). Every request a server receives is written to a log, so "did it reach the server" is a fact, not a guess.
  • A lab-only host map. A separate five-line addon, loaded first, rewrites the server address in the server_connect hook so the .test names land on loopback ports. It runs after the request hooks and is not part of the addon under test.
  • Ten drafts plus a final addon, each replayed with the same twelve curl requests. A scoring script compares what the client got, what each server received (and with which headers), and what was logged.
  • Unit tests for the final addon with pytest 9.2.0 and mitmproxy's taddons and tflow test helpers.
  • Not run: no model was called, no real program was tested, and no traffic left 127.0.0.1. HTTPS was checked only at the CONNECT step; we did not intercept TLS.

How to write a mitmproxy addon with an LLM

The loop has three gates, and an addon has to pass all of them:

  1. Does it load? Run it with mitmdump -s and read the first lines of the log. A load error at startup is the easy case.
  2. Do its hooks run? mitmproxy calls methods with well-known names and ignores everything else. A typo in a hook name is not an error.
  3. Does traffic come out right? Replay requests that must be forwarded and requests that must never leave, and check on the server side, not just the client side.
# 1 and 2: load it next to the lab host map and watch the log
mitmdump -p 18080 --set confdir=./mitmconf -s labhosts.py -s scope_guard.py \
  --set scope='app.lab.test,*.lab.test' --set bb_handle=lab-handle
Diagram of the loop to write a mitmproxy addon with an LLM: the model drafts an addon, mitmdump loads it next to a lab-only host map, twelve requests are replayed, and a scoreboard checks that six in-scope requests reach the lab server with the X-Bug-Bounty header, six out-of-scope requests never reach any server, and a failed reload calls for an independent egress rule
Check that the addon loads, verify the hooks, and compare client responses with the lab servers’ access logs. Image: RedRouter, Original

Step 1: Write down the job, and the requests that must never leave

Before any prompt, write the scope rules and the requests that prove them. Ours:

  • Scope: app.lab.test and any subdomain of lab.test. Not the apex lab.test, not lookalikes, not IP addresses.
  • Header: every in-scope request carries X-Bug-Bounty: lab-handle, the way some programs ask researchers to identify their traffic.
  • Findings: if an in-scope response contains a query value (four characters or more) exactly as sent, append a JSON line.
IDRequestExpected
R01GET http://app.lab.test/search?q=zzmk01Forwarded with header; reflection logged
R02GET http://api.lab.test/v1/user?id=42Forwarded with header; nothing logged
R03GET http://app.lab.test/gz?q=zzmk03 (gzip response)Forwarded; reflection logged
R04GET http://app.lab.test/safe?q=<zzmk04> (HTML-escaped)Forwarded; nothing logged
R05GET http://app.lab.test/bin?q=zzmk05 (binary body)Forwarded; no crash
R06GET http://APP.LAB.TEST/search?q=zzmk06Forwarded; reflection logged
R07GET http://notlab.test/403 from the proxy; server sees nothing
R08GET http://evillab.test/403; server sees nothing
R09GET http://app.lab.test.evil.test/403; server sees nothing
R10GET http://127.0.0.1:8001/403; server sees nothing
R11GET http://lab.test/403; server sees nothing
R12GET http://notlab.test/spoofed with a mismatched Host header403; server sees nothing

R08, R09 and R12 are the ones that matter most. They are the shapes of scope mistakes that get researchers in trouble: a lookalike domain, an in-scope name used as a prefix, and a request whose Host header says one thing while the connection goes somewhere else.

Step 2: Prompt with the current addon API

mitmproxy's addon API has changed across major versions, and models trained on older code mix the eras. The API changelog lists the breaks: version 7 renamed the connection hooks (clientconnect became client_connected) and moved mitmproxy.net.http.Headers to mitmproxy.http.Headers; version 9 deprecated ctx.log in favor of Python's logging module; version 12 simplified the content view API and renamed mitmproxy.dns.Message to mitmproxy.dns.DNSMessage. So the prompt pins the version and lists the names that exist:

Write a mitmproxy 12.3 addon (Python 3.13) as a single file ending in
addons = [ScopeGuard()].

Use only these event hooks: load(loader), configure(updated),
http_connect(flow), requestheaders(flow).
Declare options in load() with loader.add_option(name, type, default, help):
  scope (str, comma-separated; "*.example.com" means subdomains only),
  bb_handle (str).
Read options via ctx.options only after load().
Use the logging module, not ctx.log.

Rules:
- Decide scope on flow.request.host, lowercased, exact or "*." suffix match.
  Never use pretty_host or substring matching for scope.
- Out of scope: set flow.response = http.Response.make(403, ...) in
  requestheaders and in http_connect, so no server connection is made.
- In scope: set request header X-Bug-Bounty to bb_handle.
- Keep response inspection out of the generated scope guard.
- Empty scope blocks everything.
Return the file only.

The last round of the loop sends back the exact mitmdump error or the failed request lines from the scorer, nothing paraphrased.

Step 3: Drafts that never load, and one that loads with a warning

Draft 1 imported Headers from its mitmproxy 6 location:

from mitmproxy.net.http import Headers  # moved to mitmproxy.http.Headers in 7.0
Error logged during startup, exiting...
[07:46:12.544] Loading script addons/d1-stale-import.py
[07:46:12.545] error in script addons/d1-stale-import.py
ImportError: cannot import name 'Headers' from 'mitmproxy.net.http'

Draft 3 read its options in __init__, before load() had declared them:

def __init__(self):
    self.rules = [r.strip() for r in ctx.options.scope.split(",")]
AttributeError: No such option: scope

Both are the easy case: mitmdump 12.3.1 printed Error logged during startup, exiting... and quit, so no traffic flowed through a half-loaded addon. Remember that only holds at startup. Step 8 shows what the same import error does to a proxy that is already running.

Draft 2 used mitmproxy 6 names throughout: ctx.log.warn(...) for logging and a clientconnect(self, layer) hook. mitmproxy recognized the old hook and said so:

The clientconnect event has been removed, use client_connected instead. For more details, see https://docs.mitmproxy.org/dev/addons-api-changelog/.

ctx.log.warn still printed its messages on 12.3.1, and the rest of the draft was correct, so it scored 12/12. That's worth knowing, but don't rely on it: ctx.log has been deprecated since version 9, and the next cleanup may remove it.

Step 4: Hook names mitmproxy doesn't know

Draft 7 looked careful. Its scope logic was the same as the final version's. But the methods were called request_headers and on_response, names a model can easily produce, and neither is a hook. The real ones are requestheaders and response.

[07:46:39.484] Loading script labhosts.py
[07:46:39.484] Loading script addons/d7-typo-hooks.py
[07:46:39.486] HTTP(S) proxy listening at 127.0.0.1:18080.

No warning, no error. The addon loaded, its methods were never called, and the replay scored 0/12: all six out-of-scope requests reached a server, no request carried the header, and nothing was logged. mitmproxy warns about hook names it has removed (Draft 2) but has no way to know that on_response was meant to be a hook. This is the strongest argument for checking on the server side. A proxy log full of 200 OK lines looks the same whether your scope check ran or not.

The fix is mechanical: compare every method name in a generated addon against the event hooks list. In 12.3.1 that list is also available in code, as the keys of mitmproxy.hooks.all_hooks once the hook modules are imported. Anything that isn't a hook should be a private helper with a leading underscore, so a typo stands out.

Step 5: Scope checks that leak

Draft 4 combined a display hostname with unconstrained suffix and substring tests. It loaded cleanly and scored 6/12:

R06 FAIL fwd client got 403; never reached server; reflection not logged
R07 FAIL blk client got 200; OUT OF SCOPE SERVER RECEIVED 1 request(s) with X-Bug-Bounty
R08 FAIL blk client got 200; OUT OF SCOPE SERVER RECEIVED 1 request(s) with X-Bug-Bounty
R09 FAIL blk client got 200; OUT OF SCOPE SERVER RECEIVED 1 request(s) with X-Bug-Bounty
R11 FAIL blk client got 200; OUT OF SCOPE SERVER RECEIVED 1 request(s) with X-Bug-Bounty
R12 FAIL blk client got 200; OUT OF SCOPE SERVER RECEIVED 1 request(s) with X-Bug-Bounty

Four separate bugs are packed into those lines:

  • lstrip("*.") strips characters, not a prefix, and turns *.lab.test into lab.test, so notlab.test, evillab.test and the apex lab.test all end with an in-scope rule.
  • r in host lets app.lab.test.evil.test through.
  • pretty_host prefers the Host header. The destination and header differed in R12, and the guard incorrectly forwarded it. The API docs warn about exactly this: "When working in adversarial environments, this may not reflect the actual destination as the Host header could be spoofed." In regular proxy mode, flow.request.host is where mitmproxy will connect.
  • No lowercasing. pretty_host returned APP.LAB.TEST as typed, so an in-scope request was blocked.

Note the with X-Bug-Bounty on every leak: the out-of-scope servers received your program handle too.

Draft 5 had a correct scope function but ran it in the response hook:

def response(self, flow):
    if not in_scope(flow.request.host, ctx.options.scope):
        flow.response = http.Response.make(403, b"blocked\n")  # client sees 403...

From the client's side this draft looked perfect: all six out-of-scope requests got a 403. The server logs said otherwise:

R07 FAIL blk OUT OF SCOPE SERVER RECEIVED 1 request(s) with X-Bug-Bounty
...
R12 FAIL blk OUT OF SCOPE SERVER RECEIVED 1 request(s) with X-Bug-Bounty
score 6/12; findings logged: 3; server hits: 12

By the time response fires, the request has been sent and answered. Replacing the response only hides that from you. The http-reply-from-proxy example shows the right shape: set flow.response in a request hook, and mitmproxy replies without contacting the server. We used requestheaders, which fires when the headers are read and the body is still empty, so the decision comes before the body is read.

Step 6: Reflection checks that miss

Draft 6 raised an attribute error when it tried to read query parameters. That error appeared six times, once per in-scope response. Each flow still went through, scope blocking still worked (the request hook was fine), and the score was 9/12 with zero findings. As the addon overview says, errors raised inside event handlers "are logged but do not unload the addon." A broken detector fails one flow at a time, in the event log, while the proxy looks healthy.

Draft 6b fixed the query parsing (flow.request.query.items(multi=True)) and kept raw_content. It scored 11/12: R03, the gzip response, was missed. raw_content is "the raw (potentially compressed) HTTP message body." Decoding gzip bytes as UTF-8 with "ignore" produces junk without an exception. The final version uses get_text(strict=False), which removes the content encoding first and, per the docs, "does not raise if strict is False"; the binary R05 body came through as surrogate-escaped text and caused no error.

Step 7: The scope guard that passed

This excerpt shows the scope and tagging rules. The lab also compared three planted response markers with the expected results.

"""scope_guard: keep an authorized test inside its scope.

- Requests to hosts outside `scope` get a local 403 and never reach a server.
- In-scope requests get the program's identification header.
Run: mitmdump -s scope_guard.py --set scope='app.lab.test,*.lab.test' --set bb_handle=yourhandle
"""
import logging

from mitmproxy import ctx, http


def in_scope(host: str, rules: list[str]) -> bool:
    host = host.lower().rstrip(".")
    for rule in rules:
        if rule.startswith("*."):
            if host.endswith(rule[1:]):  # ".lab.test": subdomains only, not the apex
                return True
        elif host == rule:
            return True
    return False


def block(flow: http.HTTPFlow) -> None:
    flow.response = http.Response.make(
        403, b"blocked by scope_guard: host not in scope\n", {"Content-Type": "text/plain"})
    flow.metadata["scope_guard"] = "blocked"
    logging.info(f"scope_guard: blocked {flow.request.host}")


class ScopeGuard:
    def __init__(self):
        self.rules: list[str] = []

    def load(self, loader):
        loader.add_option("scope", str, "", "Comma-separated hosts; *.example.com for subdomains")
        loader.add_option("bb_handle", str, "", "Value for the X-Bug-Bounty request header")

    def configure(self, updated):
        if "scope" in updated:
            self.rules = [r.strip().lower() for r in ctx.options.scope.split(",") if r.strip()]
            if not self.rules:
                logging.warning("scope_guard: scope is empty, every request will be blocked")

    def http_connect(self, flow: http.HTTPFlow) -> None:
        # CONNECT tunnels (HTTPS through the proxy): refuse out-of-scope tunnels up front.
        if not in_scope(flow.request.host, self.rules):
            block(flow)

    def requestheaders(self, flow: http.HTTPFlow) -> None:
        # Decide on request.host (where mitmproxy will connect in regular mode),
        # not pretty_host (which prefers the client-controlled Host header).
        if not in_scope(flow.request.host, self.rules):
            block(flow)
            return
        flow.metadata["scope_guard"] = "in_scope"
        if ctx.options.bb_handle:
            flow.request.headers["X-Bug-Bounty"] = ctx.options.bb_handle


addons = [ScopeGuard()]
R01 PASS fwd
R02 PASS fwd
R03 PASS fwd
R04 PASS fwd
R05 PASS fwd
R06 PASS fwd
R07 PASS blk
R08 PASS blk
R09 PASS blk
R10 PASS blk
R11 PASS blk
R12 PASS blk
score 12/12; findings logged: 3; server hits: 6

Six server hits, all in scope, all with the header. Three findings: R01, R03 (gzip) and R06. R04 was correctly not logged, because the server escaped <zzmk04> to &lt;zzmk04&gt;. That's the point of matching the exact value: an escaped echo is not the same bug as a raw one. The configuration choices that matter are in the prompt: options declared in load() and read in configure() (the pattern from the options docs), and an empty scope that blocks everything instead of allowing everything.

The http_connect hook covers HTTPS. The event hooks docs say that for a CONNECT, "Setting a non 2xx response on the flow will return the response to the client and abort the connection." In the lab:

> CONNECT notlab.test:443 HTTP/1.1
< HTTP/1.1 403 Forbidden
* CONNECT tunnel failed, response 403

No server received anything. The lab also checked server-side connection counts. mitmproxy's connection_strategy option defaults to eager, which can open a TCP connection before the HTTP request hooks run. With the guard in place, the listener recorded zero connections with either strategy. Plain HTTP requests to out-of-scope hosts opened no connection in any of the four runs.

Four unit tests passed (4 passed in 0.38s). The addon overview suggests the approach: import the module, instantiate the addon, call the hook directly. We used mitmproxy's own taddons and tflow helpers to build a configured context and flows; the docs note that internal testing helpers "have no guaranteed stable API", so pin the mitmproxy version in the test requirements.

import scope_guard


def test_scope_rules():
    rules = ["app.lab.test", "*.lab.test"]
    assert scope_guard.in_scope("APP.LAB.TEST", rules)
    assert scope_guard.in_scope("api.lab.test", rules)
    for host in ["lab.test", "evillab.test", "app.lab.test.evil.test", "notlab.test", "127.0.0.1"]:
        assert not scope_guard.in_scope(host, rules), host


The remaining tests check the destination, a gzip-encoded response marker, and the empty-scope case. One thing that tripped us up while writing them: http.Response.make() encodes the body to match a Content-Encoding header you pass, so handing it already-gzipped bytes double-compresses. Pass plain bytes and let mitmproxy encode them.

Step 8: Live reload can drop your guard

mitmproxy watches scripts loaded with -s and reloads them when the file changes. The addon overview is clear about failures: "Errors raised at import time, in configure, or in running are logged to the event log and the previous version of the addon is left unregistered." We tested what that means for a scope guard. We started mitmdump with the final addon, sent two requests, then saved a version with one bad import at the top (Draft 1's line, the kind of edit a model makes in a revision) while the proxy kept running:

before edit: notlab.test -> 403 ; app.lab.test -> 200
after broken save: notlab.test -> 200 ; app.lab.test -> 200
mitmdump still running: yes
after fixed save: notlab.test -> 403

Between the broken save and the fix, mitmdump stayed up with no scope guard loaded. notlab.test received the request, and the in-scope request arrived without the X-Bug-Bounty header. At startup the same error makes mitmdump exit; during a session it silently removes your fence.

Two habits close this:

  1. Never edit the loaded file in place during a test. Iterate on a copy, run the unit tests and the replay, then replace the loaded file with a version that has passed.
  2. Enforce permitted destinations outside the addon. In our lab, mitmproxy’s built-in filter blocked some requests while the addon was unloaded. It still missed one blocking case by relying on request headers. Use an independent egress rule for the proxy and stop the replay whenever the guard fails to load.

Blocking calls stall every flow

A common follow-up request is "also post each finding to Slack" or "look up each host in our asset API." A model will usually write that with requests.post() inside a hook. We simulated a one-second synchronous call with time.sleep(1) in requestheaders (Draft 8) and sent five requests at once:

req1 5.016565s
req3 5.018255s
req5 5.018402s
req2 5.018799s
req4 5.018651s
d8-blocking: 5 concurrent requests, wall 5.03s

Every request waited for all five sleeps, one after another. The same delay as async def requestheaders with await asyncio.sleep(1) (Draft 8b):

d8b-async: 5 concurrent requests, wall 1.03s

Both drafts scored 12/12 on correctness, so the replay alone wouldn't catch this. mitmproxy's nonblocking example says hooks can be async, "which allows the hook to call async functions and perform async I/O without blocking other requests. This is generally preferred for new addons." Ask for async I/O in the prompt, or keep network calls out of the addon and process the findings file afterward.

Results across all drafts

DraftMistakeWhat mitmdump 12.3.1 didReplay
d1from mitmproxy.net.http import HeadersImportError; Error logged during startup, exiting...Did not start
d2clientconnect hook, ctx.logWarned the hook was removed; ctx.log still worked12/12
d3Options read in __init__AttributeError: No such option: scope; exitedDid not start
d4pretty_host, lstrip("*."), substring matchLoaded cleanly6/12; 5 out-of-scope hosts reached, with header
d5Scope check in responseLoaded cleanly6/12; client saw 403, all 6 out-of-scope servers reached
d6raw_content, invented query_stringAddon error 6 times; flows kept going9/12; no findings
d6braw_content onlyLoaded cleanly11/12; gzip reflection missed
d7request_headers, on_responseLoaded with no warning0/12
d8time.sleep in a hookLoaded cleanly12/12; 5 requests took 5.03 s
d8bSame delay, async defLoaded cleanly12/12; 1.03 s
Built-in filter aloneHeader-dependent destination checkLoaded cleanlyBlocked 5 of 6
finalLoaded cleanly; unit tests pass12/12
final plus built-in filterLoaded cleanly12/12 with the addon loaded
final without http_connectLoaded cleanlyOut-of-scope CONNECT opened a TCP connection (default eager)

Common mistakes in LLM-written mitmproxy addons

MistakeWhat happened in the labFix
Hook name that doesn't exist (on_response, request_headers)Loaded silently; hooks never ranCheck every method against the event hooks list
mitmproxy 6 imports and hooksImport errors exit at startup; removed hooks warnPin the version in the prompt; read the API changelog
Options read before load()No such option; exitedDeclare in load(), read in configure() or hooks
Scope on pretty_hostSpoofed Host header passedUse flow.request.host in regular mode
endswith/substring scope, lstrip("*.")Lookalikes and apex passedExact match, or suffix with the leading dot
Blocking in responseServer already received the requestSet flow.response in requestheaders
raw_content for body checksMissed the gzip reflectionget_text(strict=False) or content
Invented attributes (query_string)Per-flow Addon error, proxy kept runningrequest.query; check the API docs
No http_connect hookOut-of-scope CONNECT reached the server over TCPRefuse out-of-scope tunnels in http_connect
Sync network calls in hooks5 requests serialized to 5 sasync def hooks with async I/O
Editing the loaded script mid-testGuard unloaded; traffic flowedEdit a copy; enforce allowed destinations independently

Checking the next draft

Keep a fixed set of allowed and rejected lab requests. For each request, compare the client status, the destination server’s access log, and the presence of the expected tag. Include a case where the display hostname and connection destination disagree. Send the failed assertion or startup error back to the model, review the revised hooks and options, and run the same fixtures again.

Where this fits with Burp and Caido

mitmproxy addons are plain Python with access to every flow, which makes them a good fit for scope enforcement and tagging in a headless pipeline. If your testing lives in Burp Suite, Burp BChecks with an LLM covers scan checks in Burp's own language. If you use Caido, Caido HTTPQL queries with an LLM covers filtering captured traffic. For the full path from program scope to a submitted report, see the AI bug bounty workflow. The method is the same in all three: write the expected outcome first, run the real tool, compare.

What to send the model, and what not to

  • Send: the mitmproxy version, the hook names you want used, the option names and types, the scope rules in plain words with the edge cases (apex, lookalikes, IPs, spoofed Host), and the exact error or FAIL line from the last round.
  • Scrub: real program hostnames, your researcher handle, and anything copied from a captured flow. Use .test names, as we did.
  • Don't send: captured traffic with cookies, bearer tokens, API keys or other users' data. A model needs the shape of a request, not a live session from a program.
  • Check retention. On RedRouter, account zero data retention is an opt-in setting, off by default. The data handling docs explain what is stored and the controls, and what RedRouter keeps covers the defaults in plain terms.

Choosing a model for mitmproxy addons

Any model that returns a single Python file and fixes code from an error line will do; the harness does the judging. On RedRouter, GLM 5.3 Flash Red (glm-5.3-flash-red) is $0.25 per 1M input tokens, $0.13 per 1M cached input tokens and $1.00 per 1M output tokens. red-cyber-1 (Beta), the featured model for authorized penetration testing and red-team work, is $0.28 / $0.13 / $1.10 per 1M tokens. Current rates for every model are in the models docs, and plans are on /pricing.

Interception prompts describe traffic manipulation plainly: tag this request and refuse that destination. RedRouter is built for that kind of authorized security work.

FAQ

Can I write a mitmproxy addon with an LLM?

Yes, as a first draft. In our lab on mitmproxy 12.3.1, two of ten drafts failed to start, one loaded with misspelled hook names and silently did nothing, and two leaked out-of-scope requests to servers while looking fine from the client. Only the final addon blocked all six out-of-scope requests before connection, tagged the six in-scope ones and logged the three planted reflections.

Why does my LLM mitmproxy addon load but do nothing?

The most common reason in our tests: a method name that isn't an event hook, such as on_response or request_headers. mitmproxy only calls methods with the exact hook names (response, requestheaders) and gives no warning for other names. It does warn about hooks it has removed, such as clientconnect. Compare every method against the event hooks reference.

Which hook should an AI mitmproxy script use to block a request?

A request hook: requestheaders or request. Set flow.response there and mitmproxy answers without contacting the server. In the response hook the request has already been sent; our Draft 5 showed the client a 403 while every out-of-scope server received the request. For HTTPS through the proxy, also refuse the tunnel in http_connect: with the default eager connection strategy, an unrefused out-of-scope CONNECT opened a TCP connection to the server in our lab.

Should I use pretty_host or host for scope checks?

flow.request.host in regular proxy mode. pretty_host prefers the Host header, which the client controls, and mitmproxy's docs warn it "may not reflect the actual destination." In our lab, comparing the connection destination against the allowlist blocked the mismatched-header case.

Does mitmproxy reload an addon when I edit it?

Yes, scripts loaded with -s are reloaded when the file changes. If the new version fails to import, the old version is not kept: the addon is left unregistered and the proxy keeps running. In our test, an out-of-scope request went through until we saved a fixed file. Edit a copy, and use an independent egress rule.

Is it safe to paste mitmproxy flows into an LLM?

Paste the structure, not the session. Replace hostnames with .test names and strip cookies, tokens and other users' data before you send a request or response as an example. On RedRouter, account zero data retention is opt-in and off by default; see the data handling docs.

Sources