I have anodejs application that uses node-http-proxy to create a proxy to send the incoming requests for example: http://localhost/api/login to https://server1/api/login. here is the code used :
var httpProxy = require('http-proxy');
var proxy = httpProxy.createProxyServer();
self.routes['/api/*'] = function(req, res) {
proxy.proxyRequest(req, res,
{
target: "https://server1",
changeOrigin: true
});
};
This is working just fine in my machine. Now when i deploy this on a server, i get error:
{ [Error: getaddrinfo ENOTFOUND] code: 'ENOTFOUND', errno: 'ENOTFOUND', syscall: 'getaddrinfo' }
The problem is that there is another proxy (corporate proxy called: localProxy) between myserver and server1.
I don't know where to set the localProxy in my code above. and where to set the server1 url?
and is there is a way to use node-http-proxy in this case??