http-port-forward

2.0.3 • Public • Published

Build Status NPM Version NPM Downloads Gitter Chat

Simple port forward for incoming HTTP requests, cross-platform supported base on Node.js.

Installation

$ npm install http-port-forward

Quick Start

Use the code below to create a file named sample.js

var forward = require('http-port-forward');
 
// forward all local 1088 port http requests to 88 port.
forward(1088, 88);

Run by Node.js. If you forward to port less than 1024 on Mac/Linux, you may need execute node by sudo

$ sudo node sample.js

Now you can use http://localhost:88 to visit the page on http://localhost:1088

API

forward(portForm, portTo, options)

  • portForm Number - Required, port NO. which you want to forward from
  • portTo Number - Required, port NO. which you want to forward to
  • options Object - Optional, options Config object passed to the forward
  • options.isPublicAccess Boolean - Optional, if true the new port will be accessible for others

License

MIT(LICENSE)

Package Sidebar

Install

npm i http-port-forward

Weekly Downloads

21

Version

2.0.3

License

MIT

Last publish

Collaborators

  • meicj