Last active
January 4, 2016 06:09
-
-
Save whoeverest/8580346 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
var proxy = require('http-proxy').createProxyServer({ | |
target: 'https://192.168.88.167:5000/', | |
secure: false | |
}); | |
http.createServer(function(req, res) { | |
var delay = Math.floor(Math.random() * 100); | |
console.log('+' + delay + 'ms', req.method, req.url); | |
setTimeout(function() { | |
proxy.web(req, res); | |
}, delay) | |
}) | |
.on('upgrade', proxy.ws.bind(proxy)) | |
.listen(4433); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment