Skip to content

Instantly share code, notes, and snippets.

@albinekb
Last active August 18, 2017 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save albinekb/fa6e883b57aff05c6d8cc2341eda176b to your computer and use it in GitHub Desktop.
Save albinekb/fa6e883b57aff05c6d8cc2341eda176b to your computer and use it in GitHub Desktop.
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