Socket
Book a DemoInstallSign in
Socket

simple-reverse-proxy

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-reverse-proxy

A simple reverse-proxy

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

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);
});

Keywords

reverse

FAQs

Package last updated on 22 Apr 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.