feproxy
v3.10.2
Published
An node proxy server for web development
Downloads
2,090
Readme
FeProxy
FeProxy is a proxy tool use for web development like the Fiddler, and we use Chrome Devtools to inpect net traffic.
Install
[sudo] npm install feproxy -gUsage
feproxyIt prints the two addresses you need:
👉 Proxy server http://192.168.1.5:8888
🚀 Inspect page http://192.168.1.5:8888/admin.html- Point your browser / phone / emulator at the proxy server (host + port, HTTP proxy).
- Open the inspect page to watch traffic in Chrome DevTools' network panel and to edit forwarding rules.
To capture HTTPS, install FeProxy's root certificate on the client and trust it — open
http://<host>:<port>/feproxy.crt on the device (the cert also lives in ~/.feproxy, named
feproxy-<user>.crt). Without it HTTPS still works, but only as an opaque tunnel.
Options
feproxy [options]| Option | Default | Description |
| --- | --- | --- |
| -p, --port | 8888 | Service port |
| --hostname | feproxy.org | Hostname of FeProxy self site |
| -c, --config | ~/.feproxy | Directory of config files |
| --https / --no-https | true | Decrypt (MITM) https requests so they can be captured and modified |
| --ignore-cert-error | false | Ignore upstream certificate errors |
| --inspect / --no-inspect | true | Push requests to devtools; --no-inspect forwards only |
| --auth / --no-auth | false | Enable proxy basic authentication |
| --username | feproxy | Username of proxy basic authentication |
| --password | feproxy | Password of proxy basic authentication |
| -v, --version | | Output the version number |
| --help | | Show help |
feproxy -p 8080 # start on port 8080
feproxy --no-https # do not decrypt https requests
feproxy --no-inspect # forward only, no capturing
feproxy --auth --username me --password pwd # require proxy credentialsAuthentication applies to proxied traffic only — the inspect page, /feproxy.crt and the
other FeProxy endpoints stay open. The inspect page shows a read-only switch for whether
authentication is on; the credentials are never sent to it and cannot be changed from it.
Rules
Rules live in projects, editable on the inspect page (settings button, bottom right) or in
~/.feproxy/config.json. Each rule matches match (a case-insensitive regexp) against the
full request URL and applies one action: pick the protocol first, then fill in the fields
that protocol asks for.
| Protocol | Fields | Effect |
| --- | --- | --- |
| http(s):// | url | Forward the request elsewhere, e.g. http://127.0.0.1:3000/$1 |
| host:// | hostname, port | Keep the URL, send it to this host/port |
| file:// | path | Serve a local file, e.g. /path/to/dist/$1 |
| status:// | code, location | Reply with a status code (302 + location to redirect) |
| delay:// | milliseconds | Delay the request by N ms |
| header:// | name/value pairs | Override response headers |
$1, $2… are back-references to the capture groups of match. Rules of different types
stack (delay + header + a terminal http/file/status); for the same type only the
first match wins.
In config.json a rule is { enable, match, type, param }, where type is the protocol and
param holds those same fields:
{
"projects": [
{
"name": "my-app",
"enable": true,
"rules": [
{ "enable": true, "match": "^https?://example\\.com/static/(.*)", "type": "file", "param": { "path": "/Users/me/app/dist/$1" } },
{ "enable": true, "match": "^https?://example\\.com/api/", "type": "delay", "param": { "delay": 1000 } }
]
}
],
"https": true,
"ignoreCertError": false,
"inspect": true
}config.json is also where https / ignoreCertError are persisted when you toggle them on
the inspect page. inspect is startup-only — set it here or with --no-inspect; the inspect
page shows it read-only. Precedence is defaults ← config.json ← CLI options.
Development
git clone https://github.com/feix760/feproxy.git
cd feproxy
npm run dev