srp

simple-reverse-proxy

A simple reverse-proxy

Showing:

Popularity

Downloads/wk

9

GitHub Stars

7

Maintenance

Last Commit

7yrs ago

Contributors

0

Package

Dependencies

1

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

simple-reverse-proxy

A simple reverse proxy that takes care of managing upstream servers.

Built with node-http-proxy.

Example

var SimpleReverseProxy = require('simple-reverse-proxy');

new SimpleReverseProxy([
        'http://localhost:10001',
        'http://localhost:10002',
        'http://localhost:10003'
    ], {
        agent: false
    })
    .listen(10000);

[10001, 10002, 10003].forEach(function (port) {
    require('http')
        .createServer(function (req, res) {
            res.statusCode = 200;
            res.end();

            console.log(port);
        })
        .listen(port);
});

Upgrading from v0.0.4

Previous versions of simple-reverse-proxy provided a path-based router which has been removed in v1.0.0. This functionality can be replaced with simple-path-router. Also see simple-virtual-hosts to add host based routing/virtual hosts.

var SimpleReverseProxy = require('simple-reverse-proxy'),
    SimplePathRouter = require('simple-path-router');

new SimplePathRouter()
    .when('/', new SimpleReverseProxy(['http://localhost:10001']))
    .when('/api', new SimpleReverseProxy(['http://localhost:10002', 'http://localhost:10003']))
    .listen(10000);

[10001, 10002, 10003].forEach(function (port) {
    require('http')
        .createServer(function (req, res) {
            res.statusCode = 200;
            res.end();

            console.log(port);
        })
        .listen(port);
});

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial