proxy-agent
时间: 2023-10-05 15:07:48 浏览: 204
Proxy
Proxy-Agent是一个Node.js模块,用于在使用node.js的http或https请求访问外部网站时添加代理。它可以通过安装https-proxy-agent模块并使用相应的代码来实现。首先,需要引入HttpProxyAgent模块,并设置代理的相关信息,如代理地址、用户名和密码等。然后,在https请求的选项中使用agent属性来指定代理代理服务器。这样做可以确保请求通过指定的代理服务器发送。Proxy-Agent还可以从环境变量中获取URI来设置代理,如$HTTP_PROXY,$HTTPS_PROXY和$NO_PROXY等。这样可以方便地在程序中使用代理。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [simple-proxy-agent:通过HTTP和SOCKS代理发送HTTP和HTTPS流量的简单代理](https://download.csdn.net/download/weixin_42121272/18196684)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [nodejs 为HTTPS添加proxy](https://blog.csdn.net/yuan882696yan/article/details/53405197)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [node-proxy-agent:将代理协议映射到`http.Agent`实现](https://download.csdn.net/download/weixin_42131790/18636795)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文