Created
July 23, 2020 04:24
-
-
Save moeiscool/3d5681b1a7028346a6d2c22ca46c1eb3 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
//Testing HTTP Proxy in Node.js | |
var http = require('http'), | |
httpProxy = require('http-proxy'); | |
var proxy = httpProxy.createProxyServer({}); | |
var server = http.createServer(function(req, res) { | |
proxy.web(req, res, { target: 'http://1.1.1.1:80' }); | |
}); | |
var listeningPort = 5050; | |
var listeningIp = '127.0.0.1'; | |
console.log(`Listening on port ${listeningPort}`) | |
server.listen(listeningPort,listeningIp); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment