Last active
August 18, 2017 14:15
-
-
Save albinekb/fa6e883b57aff05c6d8cc2341eda176b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const http = require('http') | |
const httpProxy = require('http-proxy') | |
const PORT = 3005 | |
const TARGET = 'http://example.com:80' | |
const USER = '' | |
const PASSWORD = '' | |
const options = { | |
auth: `${USER}:${PASSWORD}`, | |
target: TARGET | |
} | |
const proxy = httpProxy.createProxyServer(options) | |
const proxyServer = http.createServer(function (req, res) { | |
proxy.web(req, res) | |
}) | |
proxyServer.listen(PORT, () => console.log(`Server up at http://localhost:${PORT}`)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment