通过代理使用node-XMLHttpRequest吗? [英] Use node-XMLHttpRequest through a Proxy?
问题描述
我需要将 node-XMLHttpRequest 应用程序部署到使用代理访问的服务器互联网.在该服务器上的终端中,我可以按curl -d "" http://website/path
,它可以正常工作.我认为在这种情况下,curl
可以识别环境变量http_proxy
.节点应用超时,因为它看不到代理.如何获取节点应用程序以使用代理?
I need to deploy my node-XMLHttpRequest app to a server that uses a proxy to access the internet. In a terminal on that server, I can curl -d "" http://website/path
and it works fine. I think curl
recognizes the environment variable http_proxy
in that case. The node app times out because it doesn't see the proxy. How can I get the node app to use the proxy?
例如,我可以使用 http.globalAgent 通过代理发送请求?
For instance, could I use http.globalAgent to send the requests through the proxy?
推荐答案
此派生添加了一个配置对象,该对象可以指定要使用的代理.
This fork adds a config object that can specify a proxy to use.
https://github.com/jbeuckm/node-XMLHttpRequest
这篇关于通过代理使用node-XMLHttpRequest吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!