Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
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

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
44
increased by528.57%
Maintainers
1
Weekly downloads
 
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

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc