node.js - 强制 node.exe 在 Windows 10 上抛出 proxifier

标签 node.js windows proxy telegram vpn

我正在开发bots对于 telegram ,我来自伊朗,telegram url 在我的国家被屏蔽,我被迫使用 VPN/代理服务器从我的本地开发机器访问 telegram api。

但是我的系统上运行着其他应用程序,这些应用程序无法使用 VPN,所以我被迫使用 proxifier ,我可以为需要抛出代理的应用程序定义规则。

但是node.exe由于某种原因忽略了这个规则,我可以在NetLimiter中看到连接来自 C:\Program Files (x86)\nodejs\node.exe,但是将此路径添加到 proxifier 的规则中没有效果,其他应用程序(例如 telegram 本身和 firefox 等)...符合这些规则可以很好地工作......

那么有人设法强制 node.exe 抛出 proxifier 吗?

我还尝试在我的主机中使用 php 设置代理,但我发现的代理脚本都无法处理文件上传

我最后的希望是为apache安装一些模块并将其用作代理或只安装nginx ...

我也尝试过https://github.com/krisives/proxysockethttps://github.com/TooTallNate/node-https-proxy-agent没有成功,它只是不断抛出错误:(

最佳答案

好的,经过几个小时的尝试,终于让它可以与 proxifier 一起使用了。

https://github.com/TooTallNate/node-https-proxy-agent

new HttpsProxyAgent('http://用户名:密码@127.0.0.1:8080')

<小时/>

更新: 这种方法有其问题,因此我使用node-http-proxy创建了一个小型个人代理服务器。在我的服务器上并连接到它:

process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;

const debug     = require('debug')('app');
const http      = require('http');
const httpProxy = require('http-proxy');

const proxy = httpProxy.createProxyServer({
  secure : false
});
proxy.on('error', function (e) {
  debug(e);
});

const server = http.createServer(function(req, res) {
  // You can define here your custom logic to handle the request
  // and then proxy the request.
  proxy.web(req, res, { target: 'https://api.telegram.org', });
});

server.listen(3333);

并且只是将所有请求重定向到此服务器。

关于node.js - 强制 node.exe 在 Windows 10 上抛出 proxifier,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53388801/

相关文章:

javascript - 赫罗库!找不到资源

javascript - 在对象上调用匿名函数

android - 虚拟机开发环境中物理设备上的 USB 调试

java - Glassfish 起始域在 Windows 7 中失败

ruby - 阻止或重定向请求到 Selenium 中的特定路径或域

node.js - Node 缓冲区,从 utf8 到二进制

c# - 将贝塞尔曲线段或线的端点绑定(bind)到 WPF 中的其他形状?

c++ - .NET 和 native C++ 应用程序之间通信的最佳方式

objective-c - NSProxy 类有用的真实例子,为什么?

c++ - 如何通过 Node N-API 使用第三方 dll、头文件和 lib 文件