Skip to content

Instantly share code, notes, and snippets.

@whoeverest
Last active January 4, 2016 06:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save whoeverest/8580346 to your computer and use it in GitHub Desktop.
Save whoeverest/8580346 to your computer and use it in GitHub Desktop.
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