Open ranode opened 9 years ago
+1 I'm also confused about this, in my opinion, "node-http-proxy" is aiming at reverse proxy, but we are looking for a forward proxy module
+1
I feel the same... all examples in node-http-proxy refer to hard-wired target URLs giving an indication that it is targeted as a reverse proxy. I did not see a single example anywhere of its use as a forward proxy. And when I tried, had all kinds of problems.
Hi, a little late to the party but I am currently achieving this with the following code:
var server = http.createServer(function(req, res) {
if (!! isFiltered(req)) {
// Respond with FILTERED page
return renderFiltered(res);
}
return proxy.web(req, res, {
target: req.url,
ignorePath: true,
xfwd: true
});
});
function renderFiltered(res) {
res.writeHead(403, { 'Content-Type': 'text/html' });
res.write(filteredHtml);
res.end();
}
Unfortunately I am seeing some strange issues where CDNs are sending me 404s for certain files yet the requests from the proxy are identical to those coming from the browser - it's very odd.
* UPDATE: * I resolved the 404s, it appears some wierdness within the path config was causing a duplication of the path so domain.com/path
was becoming domain.com/path/path
adding the ignorePath config prevents this.
Hello! I would like to create a forward proxy that can filter our requests to certain restricted domains, but forward all other requests to the corresponding url in the internet and send the response back to the client - something like a web filter. Is this possible with this module? Couldn't find an example on the examples folder to do this. Is there any detailed documentation?