node-debugging-proxy
A simple HTTP proxy that proxies HTTP and HTTPS requests transparently. Useful for debugging that your application works correctly with proxies.
Installation
npm i -g debugging-proxy
## or, if you prefer yarn
yarn global add debugging-proxy
Usage (as a standalone server)
Start the proxy on port 1337
debugging-proxy
Use a custom port
PORT=1234 debugging-proxy
Show logs of all requests
DEBUG=proxy debugging-proxy
Require HTTP Basic Auth for proxy access
PROXY_USER=some-username PROXY_PASS=some-password debugging-proxy
Spawn an HTTPS proxy using a custom key and cert
HTTPS_KEY=/path/to/key.key HTTPS_CERT=/path/to/cert.pem debugging-proxy
Usage (as a module, in a test)
const debugProxy = // create an instanceconst proxy = auth: // if `auth` is set, HTTP basic authentication to the proxy will be required using these credentials username: 'foo' password: 'bar' keepRequests: false // if `keepRequests` is set, the proxy will store a log of requests that can be retrieved using `proxy.getRequests()` https: // if https is set, https.createServer will be called with this key and cert to launch the server key: fs cert: fs // using your stubbing/spying library of choice... // start an httpproxy on localhost:3000proxystart3000