Skip to content

Instantly share code, notes, and snippets.

@albinekb albinekb/proxy.js
Last active Aug 18, 2017

Embed
What would you like to do?
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
You can’t perform that action at this time.