Skip to content

export the proxy itself from the main require #536

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 28, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 19 additions & 15 deletions lib/http-proxy.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
var http = require('http'),
https = require('https'),
url = require('url'),
httpProxy = require('./http-proxy/'),
proxy = exports;
httpProxy = require('./http-proxy/');

/**
* Export the the proxy "Server" as the main export
*/
module.exports = httpProxy.Server;

/**
* Creates the proxy server.
Expand All @@ -19,23 +23,23 @@ var http = require('http'),
* @api public
*/

proxy.createProxyServer = proxy.createServer = function createProxyServer(options) {
module.exports.createProxyServer = module.exports.createServer = function createProxyServer(options) {
/*
* `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()>
*
* {
* 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>
* xfwd : <true/false, adds x-forward headers>
* secure : <true/false, verify SSL certificate>
* }
*
* NOTE: `options.ws` and `options.ssl` are optional.
* `options.target and `options.forward` cannot be
* both missing
* }
*
* NOTE: `options.ws` and `options.ssl` are optional.
* `options.target and `options.forward` cannot be
* both missing
* }
*/

Expand Down