【问题标题】:How to configure node.js (express.js) app behind proxy?如何在代理后面配置 node.js (express.js) 应用程序?
【发布时间】:2017-11-14 14:14:23
【问题描述】:

我的 node.js 应用(使用 express.js)需要通过我公司的代理发送 https 请求。

我尝试了以下命令来添加代理,但它不起作用:

sudo npm config set proxy http://proxyIP:proxyPORT
sudo npm config set https-proxy https://proxyIP:proxyPORT

我仍然有超时:

Error: connect ETIMEDOUT 194.3.8.11:443
at Object.exports._errnoException (util.js:907:11)
at exports._exceptionWithHostPort (util.js:930:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1081:14)

有什么帮助吗? 非常感谢

【问题讨论】:

  • 看到那个答案enter link description here 它已经被问过了...
  • @user3732793 这不是同一个问题...我想知道代理后面的node.js应用程序是否有任何全局代理配置
  • 您可以创建配置文件并将其读取到某些选项。如文档nodejs.org/api/http.html#http_event_connect 中所述。搜索“向隧道代理发出请求”

标签: node.js linux express proxy passport.js


【解决方案1】:

问题解决了。

我使用了包global-tunnel PS:这个包依赖于tunnel包,你必须更新到版本>=0.0.5

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-03-09
    • 1970-01-01
    • 2017-07-29
    • 2016-03-07
    • 1970-01-01
    • 2014-05-15
    • 2015-10-20
    • 2015-07-13
    相关资源
    最近更新 更多