This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

tdp-http-redirector

0.1.1 • Public • Published

About tdp-http-redirector

tdp-http-redirector is a really simple HTTP redirector module (primarily intended as a standalone application) which can be daemonised or run as-is in "normal" mode (really just for testing). Purposefully low on requirements and dependencies, small (and thus hopefully at least ultimately fast) it is also easy to configure, using only standard JSON configuration files.

This is currently very much alpha in status, only manual testing has been performed so far.

Installation

Installation can be achieved easily via npm as follows:

$ npm install tdp-http-redirector

Please note that tdp-http-redirector is really only designed to run on POSIX-style (perhaps with some tweaking) it may run on Windows (though you should note that tdp-http-redirector) is case-sensitive (Windows for the most part is not).

Example usage & configuration

Ensure you have nodejs and npm installed, cd to your desirted install location then install the NPM module as shown above.

Now open config/options.js and config/redirectRules.js. Configuration should be simple and self-explanatory, each file contains comments and a working config which aside form the redirect rules may well be fine for most uses.

The following is a guide to content of each config file:

config/options.js

This file contains the main HTTP redirector options e.g. number of worker processes (daemonised mode), IP and port to bind to and HTTP headers to return for matched and unmatched rules.

config/redirectRules.js

This file contains only redirector rules which are a simple JSON obj in the form:

{
    "source-1":"destination-1",
    "source-2":"destination-2",
    …
    "source-n":"destination-n"
}

Daemon configuration

The daemon is configured in daemonHttpRedirector.js. You should not need to amend this however options can be found in the documentation for daemonize2

Using tdp-http-redirector

Daemonised mode

To start in daemonised mode, cd to your install location and type:

$ node daemon-tdp-http-redirector.js start

You can stop the daemon similarly:

$ node daemon-tdp-http-redirector.js stop

And restarting is achieved by:

$ node daemon-tdp-http-redirector.js restart

Finally, you can check the status (and get the mast process PID) by doing:

$ node daemon-tdp-http-redirector.js status

"Normal" mode (for testing)

To use TDP HTTP Redirector in "normal" mode, just run:

$ node tdp-http-redirector.js

To stop the process, just hit ctrl+c

Changelog

0.1.1 - 28th August 2012

  • Fixed clustering support in daemonised mode (thanks to Kuba - daemonize2)
  • Accordingly with the above, changed default to use clustered mode with number of forks == number of CPUs (as defined by require('os').cpus().length)

0.1.0 - 24th August 2012

  • First release

To do list

  • Improve/do functional/unit testing etc.
  • Benchmark and improve speed where possible
  • Parse & check configuration files before (re)starting
  • More comprehensive worker process management
  • Allow case=insensitivity options for redirect rules
  • Enable a simple method to support HTTPS incoming connections
  • Support for decrypted HTTPS connections to match HTTPS://x.y.x redirect rules
  • Allow redirect rules to be specified in separate includes files e.g. redirectRules/*.js (like e.g. Apache HTTPD mods/sites-available/enabled etc.)
  • Automatic or manual config reload with no downtime (and config checking)
  • Perhaps an admin GUI at some stage
  • Perhaps distributed application support

License

(The MIT License)

Copyright (c) 2012 Neil Craig (theDotProduct)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Readme

Keywords

none

Package Sidebar

Install

npm i tdp-http-redirector

Weekly Downloads

1

Version

0.1.1

License

MIT

Last publish

Collaborators

  • tdp_org