-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create proxy server behind corporate proxy #832
Comments
If you are using HTTPS, wich it seems so, you should use https-proxy-agent. You can provide a proxy server to https-proxy-agent: var HttpsProxyAgent = require('https-proxy-agent'); var proxy = httpProxy.createProxyServer({ |
Great suggestion, it works. |
I agree, this should be the go-to solution when one wants to use node-http-proxy to send requests through another proxy. |
this solution saves my day 8 years after 😆 |
Thansk @alfonso-presa ! By any chance this knowledge can be added to the documentation? The description for |
i have anodejs application that uses http-proxy to create a proxy to send the incoming requests for example: https://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 let say (corporate proxy let call it: 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 http-proxy in this case
The text was updated successfully, but these errors were encountered: