rexy
rexy launches a browser through a local man-in-the-middle (MITM) proxy. The proxy
intercepts traffic to one live site (e.g. example.com) and serves requests under a
chosen path prefix from your local dev server — everything else reaches the live site
untouched. No /etc/hosts, no DNS tricks, no self-signed certificates on your dev
server.
You give rexy three things: the domain of a live site, a path prefix, and your dev
server URL. It starts the local proxy, generates a PAC file that routes only that domain
through it, and launches Chrome (or Chromium, or any browser executable). Then you just
browse the site as usual — the matching pages are transparently served from your local
build.
How it works
./generate_ca.shgenerates a local certificate authority (one-time setup) inca/—rexy.cer(the certificate) andrexy.key(its private key).rexy trustinstalls that CA into your OS trust store, so the browser accepts the certificates the proxy issues on the fly.- On
rexy run, the tool:- starts a hudsucker MITM proxy on
127.0.0.1(a free port by default), - serves a PAC script that routes only the intercepted host (and its
subdomains) through the proxy — everything else goes
DIRECT, so messengers, WebRTC/STUN, long-poll and CDNs are unaffected, - launches the browser with
--proxy-pac-url=...and--disable-quic, - rewrites matching requests:
https://<host><path>*→<target>.
- starts a hudsucker MITM proxy on
- TLS interception is restricted to the intercepted host only.
Ctrl+C stops the browser and the proxy.
Requirements
- OpenSSL (for
generate_ca.sh) - A Chromium-based browser (Chrome / Chromium / any executable path)
Supported platforms: macOS, Windows, Linux.
Install
Quick Install (recommended)
You can install kley with a single command using the installer script.
Linux / macOS:
|
Windows:
Manual Installation
Alternatively, you can install kley by downloading a pre-compiled binary from the Releases page.
- Download the appropriate archive for your system.
- Unpack the archive.
- Move the
kleybinary to a directory in your system'sPATH(e.g.,/usr/local/binon macOS/Linux).
Install via npm (Node.js)
If you have Node.js installed, you can install rexy directly from npm:
Install via Cargo (crates.io)
If you have Rust and Cargo installed, you can install rexy directly from crates.io:
Or build from source:
Setup
# 1. Generate the local CA (one-time; creates ca/rexy.cer and ca/rexy.key)
# 2. Install the CA into the OS trust store
- macOS — installs into the login keychain via
security(trustRoot, SSL policy) - Windows — installs into the current-user
Rootstore viacertutil - Linux — copies the certificate to
/usr/local/share/ca-certificates/local-dev-proxy.crtand runsupdate-ca-certificates(viapkexec)
rexy trust is idempotent: re-running it after regenerating the CA replaces the old certificate. rexy clean removes the CA from the trust store.
Usage
rexy run --host <host> --path <path> --target <url> -- <browser args>
Example serves an url from a local Vite dev server:
If the target server sends a restrictive Content-Security-Policy that breaks the proxied page (e.g. frame-ancestors blocks embedding it in a parent shell), override the header for responses served from the target:
--csp-override off removes the header entirely. Only responses actually redirected to --target are affected; production passthrough traffic and Content-Security-Policy-Report-Only are never modified.
Commands
| Command | Description |
|---|---|
rexy run |
Launch the browser through the local proxy |
rexy trust |
Install the Rexy Local CA into the OS trust store |
rexy clean |
Remove the Rexy Local CA from the OS trust store |
run options
| Option | Default | Description |
|---|---|---|
--browser <name or path> |
chrome |
chrome, chromium, or a path to a browser executable |
--host <host> |
— | Production hostname to intercept (hostname only, no path/scheme) |
--path <prefix> |
/ |
Production path prefix to redirect (must start with /) |
--target <url> |
— | Local development server (http:// or https://) |
--proxy-port <port> |
0 |
Local proxy port; 0 picks a free port |
--csp-override <policy|off> |
— | Replace all Content-Security-Policy headers of responses served from --target (off removes them); passthrough traffic is untouched |
-- <args> |
— | Extra arguments passed to the browser |
Logging
Logging is controlled by RUST_LOG (via tracing-subscriber), e.g.:
RUST_LOG=debug
Security notes
ca/rexy.keyis the private key of your local CA. It never leaves your machine and must never be committed.- The CA is scoped to this machine's development use. Regenerate it if it may have leaked, then re-run
rexy trust. - Only traffic to the
--hostyou explicitly pass is intercepted and decrypted.
License
Licensed under the MIT License.