【问题标题】:Running a forward proxy server in nodejitsu using node js使用 node js 在 nodejitsu 中运行转发代理服务器
【发布时间】:2013-09-05 08:34:06
【问题描述】:

我是代理服务器的新手。我想做的是:我想写一些node.js代码,然后上传到我的nodejitsu账户作为代理服务器运行。然后我想在我的电脑上使用我的nodejitsu代理服务器,将http代理配置为“abc.jit.su”(我的jitsu URL),端口为“80" 在 Chrome、Firefox 或 IE 中。也就是说,我希望我的 nodejitsu 代理服务器具有与此处列出的代理相同的功能:http://www.freeproxylists.net/。有任何想法吗?

【问题讨论】:

    标签: node.js proxy nodejitsu


    【解决方案1】:

    您可以使用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,通过查看它,您可能会了解下一步该做什么。

    【讨论】:

      猜你喜欢
      • 2018-02-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-09
      • 2018-06-11
      • 1970-01-01
      • 2016-10-12
      • 2014-12-11
      相关资源
      最近更新 更多