-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.json
51 lines (51 loc) · 6.68 KB
/
package.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{
"name": "http-proxy",
"version": "1.0.0",
"description": "HTTP proxying for the masses",
"author": {
"name": "Nodejitsu Inc.",
"email": "info@nodejitsu.com"
},
"maintainers": [
{
"name": "yawnt",
"email": "yawnt@nodejitsu.com"
},
{
"name": "indexzero",
"email": "charlie@nodejitsu.com"
}
],
"main": "index.js",
"dependencies": {
"eventemitter2": "*"
},
"devDependencies": {
"mocha": "*",
"expect.js": "*",
"dox": "*",
"coveralls": "*",
"mocha-lcov-reporter": "*",
"blanket": "*",
"ws": "*",
"socket.io": "*",
"socket.io-client": "*"
},
"scripts": {
"coveralls": "mocha --require blanket --reporter mocha-lcov-reporter | ./node_modules/coveralls/bin/coveralls.js",
"test": "mocha -R landing test/*-test.js",
"test-cov": "mocha --require blanket -R html-cov > cov/coverage.html"
},
"engines": {
"node": ">=0.10.0"
},
"license": "MIT",
"readme": "<p align=\"center\">\n <img src=\"doc/logo.png?raw=true\"/>\n</p>\n\nnode-http-proxy\n=======\n\n`node-http-proxy` is an HTTP programmable proxying library that supports \nwebsockets. It is suitable for implementing components such as\nproxies and load balancers.\n\n### Build Status\n\n<p align=\"center\">\n <a href=\"https://travis-ci.org/nodejitsu/node-http-proxy\" target=\"_blank\">\n \t<img src=\"https://travis-ci.org/nodejitsu/node-http-proxy.png?branch=caronte\"/></a> \n <a href=\"https://coveralls.io/r/nodejitsu/node-http-proxy\" target=\"_blank\">\n \t<img src=\"https://coveralls.io/repos/nodejitsu/node-http-proxy/badge.png?branch=caronte\"/></a>\n</p>\n\n### Core Concept\n\nA new proxy is created by calling `createProxyServer` and passing\nan `options` object as argument ([valid properties are available here](tree/master/lib/http-proxy.js#L26-L39)) \n\n```javascript\nvar httpProxy = require('http-proxy');\n\nvar proxy = httpProxy.createProxyServer(options);\n```\n\nAn object will be returned with four values:\n\n* web `req, res, [options]` (used for proxying regular HTTP(S) requests)\n* ws `req, socket, head, [options]` (used for proxying WS(S) requests)\n* ee (an EventEmitter2 that emits events, you can hook into them to customize behaviour)\n* listen `port` (a function that wraps the object in a webserver, for your convenience)\n\nIs it then possible to proxy requests by calling these functions\n\n```javascript\nrequire('http').createServer(function(req, res) {\n proxy.web(req, res, { target: 'http://mytarget.com:8080' });\n});\n```\n\nWhen a request is proxied it follows two different pipelines ([available here](tree/master/lib/http-proxy/passes))\nwhich apply transformations to both the `req` and `res` object. \nThe first pipeline (ingoing) is responsible for the creation and manipulation of the stream that connects your client to the target.\nThe second pipeline (outgoing) is responsible for the creation and manipulation of the stream that, from your target, returns data \nto the client.\n\nYou can easily add a `pass` (stages) into both the pipelines (XXX: ADD API).\n\nIn addition, every stage emits a corresponding event so introspection during the process is always available.\n\n#### Setup a basic stand-alone proxy server\n\n```js\nvar http = require('http'),\n httpProxy = require('http-proxy');\n//\n// Create your proxy server\n//\nhttpProxy.createProxyServer({target:'http://localhost:9000'}).listen(8000);\n\n//\n// Create your target server\n//\nhttp.createServer(function (req, res) {\n res.writeHead(200, { 'Content-Type': 'text/plain' });\n res.write('request successfully proxied!' + '\\n' + JSON.stringify(req.headers, true, 2));\n res.end();\n}).listen(9000);\n```\n\n#### Setup a stand-alone proxy server with custom server logic\n\n``` js\nvar http = require('http'),\n httpProxy = require('http-proxy');\n \n//\n// Create a proxy server with custom application logic\n//\nvar proxy = httpProxy.createProxyServer({});\n\nvar server = require('http').createServer(function(req, res) {\n proxy.web(req, res, { target: 'http://127.0.0.1:5060' });\n});\n\nconsole.log(\"listening on port 5050\")\nserver.listen(5050);\n```\n\n### Contributing and Issues\n\n* Search on Google/Github \n* If you can't find anything, open an issue \n* If you feel comfortable about fixing the issue, fork the repo\n* Commit to your local branch (which must be different from `master`)\n* Submit your Pull Request (be sure to include tests and update documentation)\n\n### Options\n\n`httpProxy.createProxyServer` supports the following options:\n\n * **target**: url string to be parsed with the url module \n * **forward**: url string to be parsed with the url module\n * **agent**: object to be passed to http(s).request (see Node's [https agent](http://nodejs.org/api/https.html#https_class_https_agent) and [http agent](http://nodejs.org/api/http.html#http_class_http_agent) objects)\n\nIf you are using the `proxyServer.listen` method, the following options are also applicable:\n\n * **ssl**: object to be passed to https.createServer()\n * **ws**: true/false, if you want to proxy websockets\n * **xfwd**: true/false, adds x-forward headers\n\n\n### Test\n\n```\n$ npm test\n```\n\n### Logo\n\nLogo created by [Diego Pasquali](http://dribbble.com/diegopq)\n\n### License\n\n>The MIT License (MIT)\n>\n>Copyright (c) 2010 - 2013 Nodejitsu Inc.\n>\n>Permission is hereby granted, free of charge, to any person obtaining a copy\n>of this software and associated documentation files (the \"Software\"), to deal\n>in the Software without restriction, including without limitation the rights\n>to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n>copies of the Software, and to permit persons to whom the Software is\n>furnished to do so, subject to the following conditions:\n>\n>The above copyright notice and this permission notice shall be included in\n>all copies or substantial portions of the Software.\n>\n>THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n>IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n>FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n>AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n>LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n>OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n>THE SOFTWARE.\n\n\n",
"readmeFilename": "README.md",
"_id": "http-proxy@1.0.0",
"dist": {
"shasum": "0169541bddf9ea6d2102498fae6e8ae9c3e2c530"
},
"_from": "https://github.com/meteor/node-http-proxy/tarball/f17186f781c6f00b359d25df424ad74922cd1977",
"_resolved": "https://github.com/meteor/node-http-proxy/tarball/f17186f781c6f00b359d25df424ad74922cd1977"
}