Created
June 9, 2015 16:55
-
-
Save benkutil/5b902defe6be1149fabd to your computer and use it in GitHub Desktop.
http-proxy
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
var http = require('http'), | |
httpProxy = require('http-proxy'); | |
// | |
// Create your proxy server and set the target in the options. | |
// | |
var apiProxy = new httpProxy.createProxyServer({ | |
target: { | |
host: 'https://api.ppmroadmap.com/v1.2' | |
} | |
}); | |
apiProxy.on('proxyReq', function(proxyReq, req, res, options) { | |
proxyReq.setHeader('Authorization', 'Basic Q0Q4QTVDNTdDRTU5OUQwOTJDNjMyQjBFRDkwODAyNkM4RjYzODYwQ0NCRUYyN0RCMTQ0QjNGMTJGRTJDNEY1MTo='); | |
}); | |
var apiServer = http.createServer(function (req, res) { | |
apiProxy.web(req, res); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment