A simple REST reverse proxy written in go with dynamic configuration
Rest-proxy is a simple system to enable dynamic REST reverse proxying.
It sets up a public server to which clients will connect to request temporary redirections.
The server part:
The client part:
The main use case is when you want to develop a REST service on a machine that is not publicly visible. Using the client will generate a random identifier, and calls to http://publicserver.com/RandomID/Anything will be redirected to your local REST server.
This is similar to ssh -R
, but is simpler to use in some way:
To use the client, first get the code:
go get github.com/Gyscos/rest-proxy/rest-proxy-client
Then move to the golang bin directory (or add it to your PATH) and run:
./rest-proxy-client -h localhost:80 mypublicserver.com:6666
This will connect to the rest-proxy server (hopefully) running on mypublicserver.com:6666, ask for a temporary redirection, and print your token ID. It will keep running to maintain the communication, so don't kill it until you want to stop the redirection. Now, calls to mypublicserver.com/token will be redirected to localhost:80 for your local server to handle.
To use the server, as usual get the code:
go get github.com/Gyscos/rest-proxy/rest-proxy-server
And to start the server:
./rest-proxy-server -p 6666 -w 80
Will run the web server on port 80 and listen for requests on port 6666 (these are the default options)
Usage: rest-proxy-client [-h webhost[:PORT]] target[:TARGET_PORT]
target[:TARGET_PORT] Hostname and optionnal port to connect to.
Default port is 6666
Options:
-h webhost[:PORT] Hostname and optionnal port to redirect calls to.
Default is localhost:80
Usage: rest-proxy-server [OPTION]...
Options:
-w WEB_PORT Run the http server on port WEB_PORT.
Defaults to 80
-p CMD_PORT Run the request interface on port CMD_PORT.
Defaults to 6666