Simple HTTP proxy server module.
The proxy module supports:
- Proxy HTTP and HTTPS protocols
- Proxying via proxy server
- Customize behavior for each request (deny, change proxy, change host/port etc.)
- Customize logging
This module just relay TCP connection according to HTTP Request.
Modules are written in CoffeeScript.
So proxy module itself (src/proxy.coffee
) is small, about 120 lines.
In CoffeeScript,
proxy = require 'coffee-http-proxy'
server = proxy.createServer()
server.listen 8000, ->
console.log 'Listening on port', 8000
In JavaScript,
var proxy = require('coffee-http-proxy');
var server = proxy.createServer();
server.listen(8000, function() {
console.log('Listening on port', 8000);
});
To start proxy server,
./node_modules/.bin/proxy [--port 8000] [--proxy host:port] [--verbose]
For detail, see src/simple-proxy.coffee
.
npm install coffee-http-proxy
- Go to module directory:
cd node_modules/coffee-http-proxy
- Install grunt.js in global:
npm install -g grunt
- Install development dependencies locally:
npm install --dev
- Build and test:
grunt
- Start watching code editing:
grunt watch