Skip to content

Commit

Permalink
[fix] closes number #487
Browse files Browse the repository at this point in the history
  • Loading branch information
yawnt committed Nov 7, 2013
1 parent 590bb60 commit cde08fb
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions lib/http-proxy.js
Expand Up @@ -20,24 +20,23 @@ var http = require('http'),
*/

proxy.createProxyServer = proxy.createServer = function createProxyServer(options) {
if(!options) {
throw new Error([
"`options` is needed and it must have the following layout:",
" ",
" { ",
" target : <url string to be parsed with the url module> ",
" forward: <url string to be parsed with the url module> ",
" agent : <object to be passed to http(s).request> ",
" ssl : <object to be passed to https.createServer()> ",
" ws : <true/false, if you want to proxy websockets> ",
" xfwd : <true/false, adds x-forward headers> ",
" } ",
" ",
"NOTE: `options.ws` and `options.ssl` are optional. ",
" `options.target and `options.forward` cannot be ",
" both missing "
].join("\n"));
}
/*
* `options` is needed and it must have the following layout:
*
* {
* target : <url string to be parsed with the url module>
* forward: <url string to be parsed with the url module>
* agent : <object to be passed to http(s).request>
* ssl : <object to be passed to https.createServer()>
* ws : <true/false, if you want to proxy websockets>
* xfwd : <true/false, adds x-forward headers>
* }
*
* NOTE: `options.ws` and `options.ssl` are optional.
* `options.target and `options.forward` cannot be
* both missing
* }
*/

return new httpProxy.Server(options);
};
Expand Down

0 comments on commit cde08fb

Please sign in to comment.