我是代理服务器的新手。我想做的是:我想写一些node.js代码,然后上传到我的nodejitsu账户作为代理服务器运行。然后我想在我的电脑上使用我的 nodejitsu 代理服务器,将 http 代理配置为“abc.jit.su”(我的 jitsu URL),并将端口配置为“80"在 Chrome、Firefox 或 IE 中。也就是说,我希望我的 nodejitsu 代理服务器具有与此处列出的代理相同的功能:http://www.freeproxylists.net/ .有任何想法吗?
最佳答案
您可以使用 request 编写一个简单的代理模块,像这样:
var http = require('http'),
request = require('request');
// For nodejitsu, this will be port 80 externally
var port = process.env.PORT || 8000;
http.createServer(function(req,res) {
req.pipe(request(req.url)).pipe(res)
}).listen(port);
但是,这仅适用于 http,不适用于 https。
Nodejitsu 还生成一个 proxy module ,您可能会通过查看它来了解下一步该怎么做。
关于node.js - 使用 Node js 在 nodejitsu 中运行转发代理服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18569733/