An extremely simple reverse proxy written in Node.js that will run on anything that can run Node.js. Even on cPanel/DirectAdmin powered shared hosting providers!
-
Clone this repo.
-
Install dependencies with
npm install
or whatever method supported by your host. (For cPanel/DirectAdmin users, there should be "Run NPM install" button at where you setup the Node.js app) -
Use environment variables to setup the proxy. All environment variables start with
PROXY_
will be parsed into a config object. You must at least setup the proxy target withPROXY_TARGET
. Use one underscore_
to specify camelCased keys.For all available options you can view the docs for the underlying
http-proxy
library here.Example:
PROXY_TARGET=http://example.com PROXY_CHANGE_ORIGIN=true
will produce the following config object:
{ "target": "http://example.com", "changeOrigin": true }
-
Change the listen port by using
PORT
environment variable. Default to 8080 if not set. -
Enjoy!