reroute
Health Warn
- License — License: MIT
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Low visibility — Only 6 GitHub stars
Code Pass
- Code scan — Scanned 12 files during light audit, no dangerous patterns found
Permissions Pass
- Permissions — No dangerous permissions requested
No AI report is available for this listing yet.
The gate your app's traffic runs through. An HTTP(S) debugging proxy for macOS, in a window or in the terminal: capture API calls, mock them from files, redirect them, change them with scripts, and expose remote servers on local ports.
Reroute
The gate your app's traffic runs through.
Reroute is an HTTP(S) debugging proxy for macOS. It sits between your app and the network: it captures the app's API calls, answers them from local files, sends them to other servers, changes them with JavaScript, and exposes remote servers on local ports. You change the traffic, not the app or its server.
It is one native window, built in Rust and drawn with GPUI and gpui-component on top of the proxy engine. Every tool is a verb, and the verb is also its command in the command bar (⌘K), so most of the app is a few keystrokes away.
The change log and the user guide are on the website: https://digikala.github.io/reroute/.
Contents
- What it does
- Quick start
- How you use it
- In the terminal
- Run and build from source
- Develop
- Layout
- Data
- Updates
- Releasing
- Trace
- Scripting
- AI agents (MCP)
- Exposed ports
- Notes and limits
- Windows
- License
What it does
- Capture and find. Record HTTP and HTTPS traffic as flows (a request with its response), grouped by app, device and host. Read headers, query, body, cookies and auth, with JSON as a tree, and search inside every flow.
- Mock. Answer matching requests from a local file or folder, before the server behaviour exists.
- Redirect. Send matching requests to a different scheme, host, port, path or query.
- Script. Change requests and responses with JavaScript
onRequest/onResponsefunctions. - Expose and pair. Forward a local port to a remote host, with no certificate needed on the client, and limit it to devices that paired by scanning a QR code.
- Trace and diff. See the trace lines your app sends between the calls they led to, and compare two JSON documents side by side.
- Delegate. Let coding agents on this Mac read captured traffic and manage rules over MCP. Off until you switch it on.
Not included yet: breakpoints, request compose/repeat, WebSocket message inspection, throttling, HAR export.
Quick start
1. Get the app. Download the latest Reroute: on the release page, pick the file for your machine under Assets.
| Machine | File |
|---|---|
| Apple silicon Mac, macOS 13 or later | Reroute-<version>-arm64.zip |
Unzip the file, drag Reroute.app to Applications and open it. The app is not notarized, so if macOS says it "is damaged and can't be opened", run this in Terminal and open it again:
xattr -dr com.apple.quarantine /Applications/Reroute.app
The app also carries reroute, the same proxy in a terminal: see In the terminal.
Or build it from source with cargo run -p reroute-app. There is no Windows build for now: see Windows.
2. Trust the certificate. Press ⌘K, type connect and press Enter. The Connect screen trusts the root certificate on this Mac and switches the macOS system proxy; it also sets up Android devices over adb and iOS simulators, and has the steps for a real iPhone or iPad. The proxy listens on port 9090 by default.
3. Capture. Use your app. Each request with its response shows up as a flow; select one and the inspector shows what was sent and what came back.
4. Change something. Press ⌘K again and type a verb. mock <url> makes a mock from the last captured answer that matches and opens it in the editor; redirect, script and expose work the same way. The command table has all of them.
Once installed, the app tells you about newer versions and downloads them itself (see Updates).
How you use it
The window has one frame: the top bar, the view, and the status bar. Tools open as screens in that frame (Mocks, Redirects, Scripting, Exposed ports, Diff, Trace, Connect), not as dialogs. Esc goes back to capture.
- Top bar: the command field in the middle. On capture it is followed by the listening chip (click the IP to copy it, the port to copy
ip:port), pause/resume and clear. The IP is the one a device on the same Wi-Fi or local network reaches; when the Mac is on more networks (a VPN beside the Wi-Fi),+1lists every address with its network, and a click copies one. On any other screen the field shows the open verb and what it is working on, and acapturelink leads back. - Live rules strip (capture only): one chip per tool with rules switched on (
mock 3 on,expose :4000 :8888); a click opens that tool's screen. An exposed port that failed to open, or opened with a warning, shows in the error or warning colour, with the reason as a tooltip. On the right, how many hosts are skipped, which opens the Skip setting. - Sources (left): All flows, Trace, then pinned hosts, apps on this Mac, devices and hosts. Right-click a host to pin it, copy it, skip it, or clear its flows.
- Flows (middle):
#, METHOD, CODE, HOST, PATH, RULE (a tag for each tool that touched the flow), TYPE, SIZE, TIME. The table has sorting, resizable columns and optional columns (client, start time, request size). Right-click for Copy URL, Copy as cURL, Copy response body, Mock this answer…, Redirect this host…, Change with a script…, and with two rows selected, Diff answers and Diff requests. - Inspector (right by default;
layout right,layout bottom,layout hidden): the flow's header, a banner for each rule that touched it with a link to that rule, the actionsmock,redirect,scriptanddiff with…, and the tabs Summary, Request, Response, Cookies and Auth. JSON bodies can be read as a tree. - Status bar: counts of flows and trace lines, the follow toggle (keep the newest flow selected as traffic arrives), on the right the keys of the current screen, each a button that does what it says, and at the far right a blue Update to x.y.z button when a newer version is out.
The command bar
⌘K (or a click on the command field) opens it. Opened empty, it lists actions for the focused flow, then every verb with its syntax and its live state. Type a verb: Tab completes it, and a line under the field shows each place of the command in turn. While a place is a URL, the bar suggests addresses from captured flows and says how many captured flows the rule would match. The arrow can be typed as ->, > or to. ↑ and ↓ move, Enter runs, Esc steps back.
| Command | Enter does |
|---|---|
capture |
goes to capture |
capture pause / resume / clear |
pauses or resumes recording, clears flows and trace lines |
find <text> |
opens the find row on capture, searching every part of every flow for the text |
mock |
opens Mocks |
mock <url> |
makes a mock for that URL from the last captured answer that matches, saved as a file the editor manages, and opens it; with no captured answer, the file starts empty |
mock <url> → <file or folder> |
makes a mock that answers from that file or folder (a path ending in / is a folder) |
redirect |
opens Redirects |
redirect <url> → <host, host:port or url> |
makes the redirect and opens it; a full URL on the right is split over the fields |
script |
opens Scripting |
script <url> |
makes a script with the starter code and opens it |
expose |
opens Exposed ports |
expose <port> → <host[:port]> |
exposes the port onto that host (port 443 when none is given) |
expose <port> → any |
exposes the port onto any host named in the path, for paired devices only |
pair [port] |
opens Exposed ports with the pair panel; with no port that asks for pairing yet, offers to make one |
diff |
opens Diff; with two flows selected in the table, with their answers |
diff <#a> <#b> |
opens Diff with the answers of the two flows |
trace [text] |
opens Trace, filtered by the text |
connect [mac / android / ios / agents] |
opens Connect, at that card |
skip |
opens the Skip setting |
skip <host> |
adds the host to the skipped hosts |
delegate on / off |
switches the AI agents endpoint on or off and says its address |
settings |
opens Connect at Settings |
theme dark / light / dim / contrast / paper / tide / system |
sets the theme |
layout right / bottom / hidden |
places the inspector |
sources |
shows or hides the sources column |
follow on / off |
keeps the newest flow selected, or stops |
update |
checks for an update now |
a number, like 238 or #238 |
goes to that flow in capture |
| any other text | runs find with it |
A URL typed without a scheme is stored with a leading *://, so it matches both http and https. A rule made from the command bar goes first in its list, switched on, with its tool switched on.
Keys
On Windows, Ctrl stands in for ⌘ and Alt for ⌥, here and wherever this page names a key.
| macOS | Windows | Does |
|---|---|---|
| ⌘K | Ctrl+K | open or close the command bar |
| ⌘F | Ctrl+F | find: the find row on capture, the text filter on Trace, or a code view's own find box |
| ⌘⌫ | Ctrl+Backspace | clear flows and trace lines |
| ⌘, | Ctrl+, | Connect, at Settings |
| ⌘N, ⌘S | Ctrl+N, Ctrl+S | new rule, save (on Mocks, Redirects, Scripting and Exposed ports; save also saves the settings on Connect) |
| Esc | Esc | back one step: out of a field, then back to capture |
| ⌥S, ⌥R, ⌥W, ⌥D | Alt+S, Alt+R, Alt+W, Alt+D | mock, redirect, script, diff for the focused flow, on capture and Trace, when no text field has focus |
| Space | Space | pause or resume, while the flow table has focus |
| Delete | Delete | remove the selected flows, while the flow table has focus |
Rule screens work on a draft: a rule's switch applies at once, everything else on Save. Leaving a rule with unsaved edits asks whether to save, discard or stay.
The tools, one by one
find: search inside every flow
The find row (⌘F; hidden until used) filters by protocol, type and status and can search inside every flow (headers and bodies, including compressed ones). Each request and response pane has its own find box (⌘F) with match count and next/previous.
mock: answer from a local file
Answer matching requests from a local file (plain body, or a full HTTP message with status and headers) or a folder, with an optional delay. The Mocks screen has an editor for the file.
redirect: send it somewhere else
Send matching requests to a different scheme, host, port, path or query. A rule for everything below a path (/v1/*) moves that path and keeps the rest. The Redirects screen shows a captured flow's address before and after.
script: change it with JavaScript
JavaScript onRequest / onResponse functions that change matching traffic, with a console for console.log output. The API is under Scripting.
trace: what the code decided
Your app can send trace lines to Reroute; the Trace screen lists them between the flows, in the order things happened. How to send one is under Trace.
diff: two JSON documents side by side
Added, removed and changed values, with next/previous difference and the path of each one. Member order is ignored and arrays are aligned item by item, so one inserted item shows as one addition. Each side is a captured flow, pasted text or a file; with two flows selected, right-click to diff their answers or their requests.
expose and pair: a local port onto a remote host
expose forwards a local port to a remote host, no certificate needed on the client. One port can serve several hosts, chosen per request with a header, or any host at all, named at the start of the request's path. pair limits an exposed port to devices that paired by scanning a QR code. Both are described under Exposed ports.
connect and skip: certificates and devices
connect trusts the root certificate on this Mac, switches the macOS system proxy, sets the proxy and pushes the certificate on Android devices over adb, installs the certificate on iOS simulators, and has the steps for a real iPhone or iPad.
skip keeps a list of hosts left encrypted, for apps with certificate pinning.
delegate: let an agent look
An optional endpoint that lets coding agents on this Mac read captured traffic and manage rules. See AI agents (MCP).
Themes
Dark, light, dim, high contrast, paper and tide, or matching macOS (theme dark, theme light, theme dim, theme contrast, theme paper, theme tide, theme system). Until one is chosen, the app follows macOS.
In the terminal
reroute is Reroute in a terminal: the same frame, tools, commands and engine, drawn with ratatui. It runs its own engine on the same data folder, so it shares the rules, settings and look with the app; run one of them at a time.
It sits inside the app at Reroute.app/Contents/MacOS/reroute-tui. To put it on your PATH as reroute, type install cli in either command bar, the window's or the terminal's (or press Install the reroute command in the This Mac card of connect): that links /usr/local/bin/reroute to it. When /usr/local/bin is not yours to write, it tells you the sudo ln -s line to run instead. From the source tree, cargo run -p reroute-tui, or target/debug/reroute-tui after cargo build --workspace.
| Command | What it does |
|---|---|
reroute |
opens Reroute in this terminal |
reroute app |
opens the window instead |
reroute --port <port> |
listens on that port for this run |
reroute --data-dir <dir> |
keeps the files in that folder instead of the app's |
reroute --theme <name> |
paints this run in a theme (theme <name> in the command bar is what saves one) |
reroute --mock |
generated traffic on a scratch data folder, with the flags of Develop |
What differs from the window:
- Ctrl stands in for ⌘ and Alt for ⌥ in every key of the table: Ctrl+K opens the command bar, Ctrl+S saves, Alt+S mocks the focused flow.
- Ctrl+,, Ctrl+1 to Ctrl+7, Ctrl+0 and Ctrl+Shift+R only arrive in a terminal that speaks the kitty keyboard protocol (kitty, WezTerm, Ghostty, foot, Alacritty; not Terminal.app). Elsewhere type
settings, the tool's name (mock…connect),capture, orcapture pause/resumein the command bar. - The Alt verbs (Alt+S, Alt+R, Alt+W, Alt+D) need Option to act as Meta: in Terminal.app, Settings → Profiles → Keyboard → Use Option as Meta key; in iTerm, Settings → Profiles → Keys → Left Option key: Esc+.
- Lists and the code view also take
jandk,gandG(top and bottom), Ctrl+D and Ctrl+U (half a page), beside the arrows and page keys. quitin the command bar, or Ctrl+Q, quits, and puts back the system proxy if Reroute switched it on.- The mouse clicks, scrolls and drags the splitters. A file or folder is chosen in a picker or typed with Tab completion.
- Shift+Enter (the previous match in a find box) also needs the kitty keyboard protocol; ↑ does the same in any terminal.
Run and build from source
Prerequisites: Rust, installed with rustup. rust-toolchain.toml pins the toolchain (1.100.0, with rustfmt and clippy), and rustup installs it the first time cargo runs in this folder. On macOS the Xcode Command Line Tools are enough: the Metal shaders are compiled when the app starts.
cargo run -p reroute-app
Build the release app and export it to release/ (Reroute.app with the reroute command inside, plus Reroute-<version>-<arch>.zip for sharing):
cargo xtask bundle
The app is built for the Mac it is built on, and release/ is emptied first.
| Option | What it does |
|---|---|
--sign <identity> |
signs for distribution with a "Developer ID Application: …" identity, given by name or by its SHA-1 from security find-identity -v -p codesigning, with the hardened runtime and a timestamp. Also read from REROUTE_SIGN_IDENTITY. Without it the signature is ad hoc |
--no-runtime-shaders |
compiles the Metal shaders ahead of time. Needs full Xcode (xcrun metal) |
--target <triple> |
Windows only: builds for another target (aarch64-pc-windows-msvc or x86_64-pc-windows-msvc) |
The proxy listens on port 9090 by default. Type connect in the command bar to trust the certificate and connect devices.
Develop
| Command | What it does |
|---|---|
cargo run -p reroute-app -- --mock |
The app against generated traffic, with a made-up update server that reports a newer version |
cargo run -p reroute-app --example gallery |
The widget gallery: every widget in every state, in all six themes, without the engine |
cargo run -p reroute-tui |
Reroute in the terminal (-- --mock for generated traffic, with the flags below) |
cargo run -p reroute-tui --example tui_gallery |
The terminal widget gallery, without the engine |
cargo test -p reroute-app |
App unit tests: the command parser, filters, the screens' logic and the keys |
cargo test -p reroute-logic |
The pure logic: the command grammar, filters, formatting, JSON diff, mock traffic |
cargo test -p reroute-host |
Tests of the shell logic: the agent endpoint and the update check |
cargo test -p reroute-core |
Engine unit tests and end-to-end tests on loopback |
cargo clippy --workspace --all-targets -- -D warnings |
Lint: clippy's default set with no warnings left, as [workspace.lints] in the root Cargo.toml states |
cargo fmt --all |
Format |
cargo run -p reroute-core --example headless |
The engine without the app, printing requests to the terminal |
Flags that go with --mock (ignored without it):
| Flag | What it does |
|---|---|
--seed <n> |
starts with n flows instead of 40 (--seed 10000 to stress the table) |
--quiet |
no live traffic |
--update none |
the app is up to date |
--update error |
the check fails |
--update noarch |
the release has no zip for this Mac |
--update badzip |
the download fails |
Under --mock the engine still runs, on a scratch data folder (reroute-mock in the system's temporary folder, kept between runs), so rules and settings are saved for real but never in your own data folder. Everything that would change the machine is faked: the keychain, the system proxy, adb and simctl are never touched.
Try the headless engine with curl:
curl -x http://127.0.0.1:9090 --cacert "$TMPDIR/reroute-headless/ca/reroute-ca.pem" https://example.com/
The CI workflow (.github/workflows/ci.yml) checks every pull request and every push to main on a macOS runner: cargo fmt --all -- --check, the clippy line above, and cargo test --workspace --no-fail-fast.
Layout
The workspace, crate by cratecrates/reroute-core/ Engine: no UI dependency
src/pipeline.rs the path every request takes (capture, rules, forwarding, the proxy's own pages)
src/forward.rs forward proxy with HTTPS interception (hudsucker)
src/expose.rs exposed port listeners
src/rules/ mocks, redirects, exposed ports, URL matcher
src/script.rs JavaScript sandbox for scripts
src/store.rs in-memory store of flows and trace lines, and change events
src/trace.rs trace lines sent by apps
src/devices.rs pairing code and paired devices
src/ca.rs root certificate
tests/engine.rs end-to-end tests
crates/reroute-host/ Shell logic with no UI
src/core.rs the engine and what the UI asks of it, shared by the UI and the MCP endpoint
src/files.rs the saved files in the data folder
src/stream.rs flow events batched for the UI
src/mcp/ MCP endpoint for AI agents: server, tools, tests
src/update.rs update check and download
src/system/ macOS proxy and keychain, adb, simctl, and the Windows proxy and certificate store
crates/reroute-logic/ Pure logic shared by the window and the terminal UI
src/command.rs the command grammar and its suggestions
src/filters.rs flow filters; src/format.rs, json_diff.rs, http_message.rs, the rule parts and drafts
src/mock_traffic.rs generated traffic for `--mock`
crates/reroute-app/ The app
src/main.rs startup: engine, saved look, window, menus, keys
src/bridge.rs the engine's async work and flow events, brought to the UI
src/actions.rs the app's actions and their keys
src/menu.rs the menu bar
src/commands.rs what the commands do
src/prefs.rs ui-prefs.json
src/model/ app state: status and rules, flows, the window's state, devices, updates
src/theme/ the six themes painted (their names and choices are in reroute-logic)
src/widgets/ buttons, fields, switches, dialogs and the other small parts
src/views/ the window: top bar, command bar, live rules, find row, sources, flow table, inspector, status bar
src/screens/ each tool's screen in its own folder (mock, redirect, script, expose, diff, trace, connect), rules/ for what the rule screens share, and the update dialog
examples/gallery.rs the widget gallery
assets/ fonts and icons
packaging/ Info.plist and the icon of Reroute.app
crates/reroute-tui/ The `reroute` command (the `reroute-tui` binary): the app in a terminal, on ratatui
xtask/ Build tasks: `cargo xtask bundle`
Cargo.toml The workspace: the version, the shared dependencies and the lint rule
rust-toolchain.toml The pinned Rust toolchain
.github/workflows/ CI, Release and Windows workflows
Five crates and a build task: reroute-core is the engine and has no UI dependency, reroute-host is the shell logic with no UI (shared by the window and the MCP endpoint), reroute-logic is the pure logic (command grammar, filters, formatting, JSON diff, mock traffic) with no gpui dependency, reroute-app is the app, reroute-tui is the reroute command (built as reroute-tui, and linked as reroute by install cli), and xtask holds cargo xtask bundle.
Data
Everything lives in ~/Library/Application Support/Reroute/:
ca/root certificate and its private key,reroute-ca.pemandreroute-ca.key(generated on first launch, never leaves the Mac)settings.json,rules.jsonui-prefs.jsonhow the window looks: the theme, pinned hosts with their order and sort, column widths and which optional columns are shown, splitter sizes. The app works without it; a missing or damaged file only means nothing is rememberedupdate.jsonupdate server address and whether to check automaticallymcp.jsonwhether AI agents may connect, and on which portdevices.jsonthe pairing code and the devices paired to use exposed portsmocks/files written by the mock editorsystem-proxy-backup.jsonpresent while Reroute is the macOS proxy: the settings to put backcrash.logwhere the app crashed and how it got there, appended on each crash (and on a failure the engine recovered from); it starts over once it grows past 256 KiB. A crash also puts back the system proxy
Flows and trace lines are kept in memory only and are gone when the app quits.
Updates
The app asks an update server for the latest version, announces a newer one in the status bar and downloads its zip.
The settings (settings, or ⌘,) hold, under "Updates and look", the address of the update server and the "Check automatically" option (on by default). With an address set, the app checks shortly after launch and every 6 hours. A newer version shows as a blue "Update to x.y.z" button at the right end of the status bar; clicking it opens the change log (every version newer than the installed one) and a Download button. "Check now" in the settings checks the address as typed, saved or not; the update command checks the saved one. An address saved empty goes back to the built-in one; to stop the automatic checks, untick the option.
To install a downloaded update, quit Reroute, unzip the file and replace Reroute.app in Applications. The app downloads the zip itself because it is not notarized: a zip saved by a browser is quarantined and macOS then refuses to open the app inside.
The address is a URL that answers a GET with the latest release as JSON. The website (site/ in this repository, published at https://digikala.github.io/reroute/) publishes it on GitHub Pages at /api/latest, built from this repository's GitHub releases:
{
"version": "1.2.0",
"publishedAt": "2026-11-23T12:28:52Z",
"downloads": [
{ "arch": "arm64", "url": "https://github.com/digikala/reroute/releases/download/v1.2.0/Reroute-1.2.0-arm64.zip",
"fileName": "Reroute-1.2.0-arm64.zip", "size": 8327434, "sha256": "<lowercase hex>" }
],
"changelog": [
{ "version": "1.2.0", "date": "2026-11-23T12:28:52Z", "changes": ["One line per change", "..."] },
{ "version": "1.1.0", "date": "2026-11-22T12:13:24Z", "changes": ["..."] }
]
}
archisarm64(Apple silicon) orx64(Intel); the app takes the entry for the Mac it runs on. Onlyversionand, per download,archandurlare required. The zip can be hosted on any site; a relativeurlis resolved against the address.changeloglists releases in any order; the app shows the ones newer than the installed version, newest first.- A 404 with
{"error": "..."}means no release has been published yet, which counts as up to date. - The zip is saved to
~/Downloadsunder itsfileName, else the name at the end of itsurl, elseReroute-<version>-<arch>.zip(asReroute-1.2.0-arm64 (1).zipand so on if the name is taken), and is kept only if it is a zip archive and matchessha256(or, without a checksum,size) when the endpoint gives one. The link has to answer with the zip itself, not with a page that offers it. - Update requests never go through a proxy, so they do not appear among the captured flows even while Reroute is the system proxy. Certificates are checked by macOS, so a server with a certificate from a company CA in the keychain works, as does plain
http://. - The address a fresh install starts with is
DEFAULT_UPDATE_ENDPOINTincrates/reroute-host/src/update.rs:https://digikala.github.io/reroute/api/latest. - On Windows the app would take the entry whose
archiswindows-arm64orwindows-x64. Windows builds are paused, so no release carries one for now.
Releasing
Set
versionunder[workspace.package]in the rootCargo.tomland get that commit ontomain. It is the only place: the three crates inherit it, and the bundle, the update check and the agent endpoint use it.Cargo.lockfollows on the next build; commit it too.Tag it
v<version>and push the tag:git tag v1.2.0 && git push origin v1.2.0. The Release workflow (.github/workflows/release.yml) builds the Apple silicon app on a macOS runner withcargo xtask bundle, creates the GitHub release for the tag and attachesReroute-<version>-arm64.zip. It stops before building when the tag is not onmainor does not match that version. Windows releases are paused: nothing for Windows is built or attached.The release notes are the change log, one change per line. They are the tag's own message when the tag has one (
git tag -a v1.2.0, a change per line), and otherwise the subject of each commit since the last version tag. Edit them on the release afterwards if they need it.The workflow signs the app ad hoc: the runner has no signing identity. Signing with a Developer ID is done by hand for now, on an Apple silicon Mac with the identity in its keychain, on the tagged commit:
cargo xtask bundle --sign "Developer ID Application: …" gh release upload v<version> release/Reroute-<version>-arm64.zip --clobberThe identity can also be set as
REROUTE_SIGN_IDENTITY. The app is signed with the hardened runtime and a timestamp, but notarisation is not automated yet, so the released app is not notarized.Rebuild the website:
gh workflow run pages.yml(or Actions → Pages → Run workflow). The download page, the change log and/api/latestthen show the new version, and installed apps offer it on their next check. Without this, the site picks the release up on its daily build.
Trace
Capture shows what an app sent. To also see what its code decided, the app can send trace lines; the Trace screen (trace, or Trace in the sources) lists trace lines and flows together in the order they happened, so a line like "new checkout is on" sits right above the calls it led to. Filter by level, by tag, by text, or show lines only. Click a line to read its message in full and its data as a tree, with a link to the flow just before it. The screen also has the snippet to send a line, with a copy button.
A trace line is one HTTP request to the proxy itself:
| The code runs | Send to |
|---|---|
| in an app or web page whose traffic goes through the proxy (phone, emulator, browser) | http://reroute.gate/trace, or https://reroute.gate/trace from an HTTPS page |
| on this Mac without the proxy (Node, a script, a backend) | http://127.0.0.1:9090/trace (the proxy port) |
| in an app that calls an exposed port | http://<mac-ip>:<port>/reroute.gate/trace |
fetch('http://reroute.gate/trace', { method: 'POST', body: JSON.stringify({ message: 'flag checked', level: 'info', tag: 'flags', data: { enabled } }) });
curl -d 'checkout started' 'http://127.0.0.1:9090/trace?tag=checkout&level=warn'
- The body is plain text (the message), or JSON with
messageand optionallylevel(debug,info,warn,error),tag(a short label to group lines) anddata(any JSON). Withoutdata, the other fields of the object become the data. JSON without amessageis kept whole as the data. level,tagandmessagecan also be given in the query string, soGET /trace?message=…works where a POST is awkward.- A line can be 256 KB at most. The answer is
{"stored": true, "id": 42}; while capture is paused nothing is kept andstoredisfalse. - Web pages may send lines too: the answer allows any origin.
- Trace lines take their numbers from the same sequence as flows, which is why the
#column of the flow table skips the numbers that went to trace lines. The newest 10,000 lines are kept. Clearing removes them along with the flows. - "Accept trace lines from apps" in the settings (Engine group) switches this off. While on, anyone who can use the proxy can send lines, which includes devices on your network when "Allow phones and other devices on the network" is on.
Output of scripts (console.log) is separate and stays in the console of the Scripting screen.
Scripting
The Scripting screen (script, or right-click a flow → Change with a script…) holds the scripts. A script matches requests by URL like the other tools, runs on the Request, the Response or both (its two checkboxes), and defines one or both of:
async function onRequest(context, url, request) {
request.headers["X-Debug"] = "1"; // header names are case-insensitive
request.queries.page = "2";
request.body.name = "changed"; // JSON and form bodies are objects, other text is a string
return request; // also: method, scheme, host, port, path
}
async function onResponse(context, url, request, response) {
response.statusCode = 200;
response.body.items = [];
// response.bodyFilePath = "~/Desktop/mock.json"; // answer with a file instead
return response;
}
- Answer without the server skips the server:
onResponsestarts from an empty 200 and builds the whole answer. context.sharedStateis an object kept between calls (for counters, tokens and the like). It is shared by all scripts and lost when the app quits.console.log,info,warnanderrorgo to the console under the editor, as do errors thrown by the script. A script that fails leaves the request or response unchanged.- Scripts are plain JavaScript run in a sandbox: no network access, timers, imports or file access (other than
bodyFilePath). A call is stopped after 5 seconds. Bodies over 20 MB skip the script. - A response edited by a script is sent uncompressed. Mock answers are not passed through
onResponse.
AI agents (MCP)
Reroute can serve a Model Context Protocol endpoint, so an agent such as Claude Code or Cursor can look at the traffic and set up rules while it works on your app. It is off until you switch it on: delegate on, or "Let AI agents on this Mac connect" on the AI agents card of the Connect screen (connect agents). The address is then http://127.0.0.1:9191/mcp (Streamable HTTP; the port can be changed on the card).
claude mcp add --transport http reroute http://127.0.0.1:9191/mcp
Other agents take the same address in their MCP settings. The card has a button that copies the address and one that copies the command above.
What an agent can do:
| Tool | |
|---|---|
get_status |
proxy address, capture on/off, number of flows and trace lines, id of the newest one, certificate path, where apps send trace lines (traceUrl for code on this Mac, traceUrlViaProxy for code whose traffic goes through the proxy) |
list_flows, search_flows |
captured flows as short rows, filtered by host, URL, method, client (a device's IP address or a program's name), status or rule; full-text search |
get_flow |
one flow with headers and decoded bodies; long bodies come in pages |
wait_for_flows |
waits for flows that match to finish, for "do something, then see what it sent" |
list_trace_lines |
trace lines the app sent, filtered by level, tag or text |
get_trace |
trace lines and flows together in the order they happened, for "add a trace line to the code, run it, see which calls followed" |
get_rules, get_script_logs |
the rules and the script console |
set_capturing, clear_flows |
pause or resume recording, remove flows and trace lines |
save_mock, save_redirect, save_script, save_exposed_port |
create or replace a rule; a mock's answer can be given inline |
set_rule_enabled, delete_rule |
switch a rule or a whole tool on or off, remove a rule |
An agent sends its own traffic through the proxy the usual way (curl -x http://127.0.0.1:9090 --cacert <certificate> …); get_status gives it both values. To follow what your code does, it adds temporary trace lines (see Trace), runs the app and reads get_trace. Rules an agent saves show up in the window at once and stay until removed.
Not exposed: the settings, the macOS system proxy, device and certificate setup, and updates.
Who can connect: only programs on this Mac. The endpoint listens on 127.0.0.1 whatever "Allow phones and other devices on the network" says, and it refuses requests that come from a web page (any Origin header) or under another host name. There is no password, so every program running as you can use it while it is on. Captured traffic includes passwords, tokens and cookies, and a mock can serve any file you can read. Switch it on when an agent needs it.
Exposed ports
An exposed port forwards a local port to a remote host, so the client needs no certificate: expose <port> → <host[:port]>, or the Exposed ports screen. "Reaches" on that screen decides how many hosts the port serves.
Several hosts on one exposed port
"Reaches" set to Several, picked by a header gives a port a default remote host and a table of more domains. A request picks one with a header (X-Reroute-Target unless the port names another):
curl http://localhost:4000/v1/home # default remote host
curl -H 'X-Reroute-Target: search' http://localhost:4000/v1/query # the domain whose header value is "search"
The header value is the name given to the domain on the port, or its host name. The header is removed before the request is forwarded. A value that matches no domain gets a 400 that lists the accepted values.
One exposed port for any host
For an app that can rewrite the address of its own requests (a QA build, say), one port can stand in for every server. Set "Reaches" to Any host, named in the path (or type expose <port> → any): the port then needs no remote host, and each request names its server at the start of its path.
| The app wants | It sends |
|---|---|
https://api.example.com/v1/users?page=2 |
http://<mac-ip>:<port>/https://api.example.com/v1/users?page=2 |
| the same, in short | http://<mac-ip>:<port>/api.example.com/v1/users?page=2 |
http://legacy.example.com/ping |
http://<mac-ip>:<port>/http://legacy.example.com/ping |
So the change in the app is one line: put http://<mac-ip>:<port>/ in front of the original URL. Without a scheme, a bare host means HTTPS; host:port means HTTPS only for port 443. Flows are listed under the real server, and mocks, redirects and scripts written for the real URL apply.
Redirects and cookies are put in the port's terms on the way back, so the app stays on the port: a Location gets the server's prefix, and a cookie loses Domain and Secure and gets the prefix on its Path. The captured response still shows what the server sent.
The app's trace lines go to http://<mac-ip>:<port>/reroute.gate/trace, the same page as http://reroute.gate/trace.
Pairing devices with a QR code
Tick Only paired devices may use it on a port (it comes on with any host) and the port answers 403 to every address except this Mac and the devices that have paired. The pair panel on the right of the Exposed ports screen (pair, or pair <port>) shows the QR code and the devices paired so far, where they can be removed. With no such port yet, it offers to make one.
The code holds one address: http://<mac-ip>:<port>/reroute.gate/pair?token=<token>. Only a device on the network of <mac-ip> can use it, so the choice under the code names this Mac's networks (Wi-Fi, Ethernet, VPN) with the likeliest one first and says who can scan it; a VPN address is reachable only from the same VPN. Choose Other address… to type one by hand. The app scans it and sends a GET to that address, optionally with &name=<what to call the device>. The answer is JSON:
{ "ok": true, "endpoint": "http://192.168.1.10:8888", "device": "192.168.1.44", "name": "Pixel 8" }
endpoint is what the app puts in front of its URLs from then on. A wrong or outdated token gets 403 with "ok": false. Opening the address in a browser pairs the device too (a phone's camera does that), which is a way to try it before the app has a scanner.
A paired device's flows are grouped under its IP address in the sources, with the name it gave beside it.
What to know:
- The app needs permission to use plain HTTP to the Mac: a
network_security_configthat allows cleartext to its address on Android,NSAllowsLocalNetworkingand the Local Network permission on iOS. - A device is known by its IP address. If the address changes, the device scans again; a device that later gets a paired address is let in. New code makes earlier codes useless; paired devices stay paired.
- The code and all requests cross the network in plain HTTP. Pairing keeps other people on the network off the port. It is not a login.
- An any-host port without "Only paired devices may use it" lets anyone on the network reach any server through the Mac, including services on the Mac itself.
- Cookies a server sets for a parent domain are not shared between its subdomains here, and addresses inside response bodies are not rewritten.
Notes and limits
- Android apps trust user-installed certificates only if they opt in (
network_security_config, usually for debug builds). The Android card on the Connect screen (connect android) has the snippet. - Apps with certificate pinning fail when intercepted. Skip their hosts:
skip <host>, Skip this host on a host in the sources, or the Skip group of the settings. - Upstream connections use HTTP/1.1. Clients may still speak HTTP/2 to the proxy.
- Flows that came in through an exposed port are listed under the remote server's URL, not
http://localhost:<port>/...(the inspector's Summary shows the local URL as "Requested as"). Mocks and redirects can be written against either URL. - Exposed ports do not carry WebSockets.
- The ⌥ keys (⌥S, ⌥R, ⌥W, ⌥D) go by the letter the keyboard layout gives a key, not by the key's place on the keyboard. On Dvorak or AZERTY, press the key that types the letter.
- Dates in tooltips and in the change log are written in English, whatever the system's language.
Windows
Windows is paused. The current app has not been built or tested on Windows. The last release with a Windows installer is 1.1.1 (Reroute-1.1.1-windows-x64-setup.exe); it stays on the release page and is not updated.
What is missing:
- an installer (
cargo xtask bundleon Windows only zipsReroute.exe) - the icon and version information in the exe
- a menu bar
What differs from macOS, in the code that is kept for it:
- The system proxy is the user's own setting in the registry (Settings → Network → Proxy), so no administrator prompt appears.
- The certificate goes into the user's Trusted Root Certification Authorities. Windows shows its own warning first.
- The update check asks for a download named
windows-arm64orwindows-x64in the release'sdownloads.
License
MIT. See LICENSE.
Reviews (0)
Sign in to leave a review.
Leave a reviewNo results found