0.0.5 • Published 10 years ago
proxy-kit v0.0.5
Overview
Why another proxy tool?
Nginx's if condition
syntax sucks, and I need more flexibility.
Writing coffeescript is much much better than learning
another javascript like config-language with no debugging break point.
Performance
It won't be a bad idea to use it behind a nginx server.
Install
npm install proxy-kit
Quick Start
Reverse Proxy
Proxy_kit = require 'proxy-kit'
manager = new Proxy_kit { port: 80 }
manager.add Proxy_kit.reverse_proxy(
'http://one.ysmood.org:8013'
)
Prefix Proxy
Under the main namespace there's a predefined function prefix_proxy
, we use it for demo.
Proxy_kit = require 'proxy-kit'
manager = new Proxy_kit { port: 80 }
manager.add Proxy_kit.prefix_proxy(
'http://one.ysmood.org:8013' # target
'http://one.ysmood.org/prefix' # referer
'/prefix' # prefix
)
Then when client visit http://one.ysmood.org/prefix/index?q=10
,
the server behind the proxy will get http://one.ysmood.org:8013/index?q=10
without the word prefix
.
Useful when you only have one subdomain name, and want to bind it to multiple servers.
Road Map
Add more handy functions to the kit.
Error handling.