This is a Node.js extension module for implementing a very simple HTTP proxy which allows you to on-the-fly intercept and modify HTTP request/response header and payload information. It is primarily intended for development scenarios where a full-featured HTTP proxy is not necessary but the data of an own application needs to be on-the-fly modified for testing and instrumentation purposes.
Use the Node Package Manager (NPM) to install this module
locally (default) or globally (with option
$ npm install [-g] http-proxy-simple
var proxy =;proxy;proxy;proxy;proxy;proxy;proxy;proxy;
createProxyServer(options: Options): ProxyServer
Create a proxy server. The following options are supported:
host: IP address (or name) for listening for HTTP proxy requests. Defaults to
port: TCP port for listening for HTTP proxy requests. Defaults to
servername: server host name for identification purposes in HTTP
Viaheaders. Defaults to the result of
id: optional software name/version pair for identification purposes in HTTP
Viaheaders. Defaults to
proxy: optional upstream proxy to forward requests to. Defaults to
""(no forward proxy).
The following events are emitted:
(cid, socket, error)
(cid, socket, had_error)
(cid, request, response)
(cid, error, request, response)
(cid, request, response, remoteRequest, performRequest)
(cid, request, response, remoteResponse, remoteResponseBody, performResponse)
Thanks to Michael C. Axiak for its FilterNet module which inspired this module. FilterNet is more feature-packed (it also provides SSL/TLS support, compression support, etc) but had too much dependencies and especially did not support proxy forwarding.
Copyright (c) 2013-2017 Ralf S. Engelschall (http://engelschall.com/)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.