Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update Server

  • Loading branch information...
commit 4760b243c304337228ce759cf074d1368a16ab1a 1 parent a6f5ecd
Jason authored
Showing with 24 additions and 0 deletions.
  1. +24 −0 server.js
View
24 server.js
@@ -0,0 +1,24 @@
+var httpProxy = require('http-proxy');
+
+var addresses = [
+ {
+ host: 'IP_ADDRESS-1',
+ port: 80 //web port on server 1
+ },
+ {
+ host: 'IP_ADDRESS-2',
+ port: 80 //web port on server 2
+ }
+];
+
+httpProxy.createServer(function (req, res, proxy) {
+
+ var target = addresses.shift();
+
+
+ console.log('balancing request to: ', target);
+ proxy.proxyRequest(req, res, target);
+
+ addresses.push(target);
+}).listen(1024);
+
Please sign in to comment.
Something went wrong with that request. Please try again.