https://github.com/h2non/http-forward
Simple one-line proxy forward for incoming HTTP requests. Built for node.js/io.js
https://github.com/h2non/http-forward
Last synced: 8 months ago
JSON representation
Simple one-line proxy forward for incoming HTTP requests. Built for node.js/io.js
- Host: GitHub
- URL: https://github.com/h2non/http-forward
- Owner: h2non
- Created: 2015-08-14T09:00:09.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-08-25T10:35:15.000Z (over 10 years ago)
- Last Synced: 2024-10-18T11:25:24.773Z (about 1 year ago)
- Language: JavaScript
- Size: 164 KB
- Stars: 7
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# http-forward [](https://travis-ci.org/h2non/http-forward) [](https://www.npmjs.org/package/http-forward)
Simple proxy forward for incoming HTTP requets. Built for node.js/io.js.
## Installation
```
npm install http-forward
```
## API
```js
const http = require('http')
const forward = require('http-forward')
var server = http.createServer(function (req, res) {
// Define proxy config params
req.forward = { target: 'http://new.server.net' }
forward(req, res)
})
server.listen(3000)
```
### forward(req, res, callback)
- **req** `http.IncomingMessage` - Required
- **res** `http.OutgoingMessage` - Required
- **callback** `function(err, res)` - Optional callback
## License
MIT - Tomas Aparicio