### HttpsProxyAgent Constructor Source: https://www.npmjs.com/package/https-proxy-agent?activeTab=versions The HttpsProxyAgent class allows you to create an agent that connects to a specified HTTP or HTTPS proxy server. It uses the HTTP CONNECT method to proxy requests. You can provide the proxy URL and optional configuration options. ```APIDOC ## new HttpsProxyAgent(proxy: string | URL, options?: HttpsProxyAgentOptions) ### Description The `HttpsProxyAgent` class implements an `http.Agent` subclass that connects to the specified "HTTP(s) proxy server" in order to proxy HTTPS and/or WebSocket requests. This is achieved by using the HTTP `CONNECT` method. The `proxy` argument is the URL for the proxy server. The `options` argument accepts the usual `http.Agent` constructor options, and some additional properties: * `headers` - Object containing additional headers to send to the proxy server in the `CONNECT` request. ``` -------------------------------- ### HttpsProxyAgent Constructor Source: https://www.npmjs.com/package/https-proxy-agent?activeTab=dependencies The HttpsProxyAgent class implements an http.Agent subclass that connects to the specified "HTTP(s) proxy server" in order to proxy HTTPS and/or WebSocket requests. This is achieved by using the HTTP CONNECT method. ```APIDOC ## new HttpsProxyAgent(proxy: string | URL, options?: HttpsProxyAgentOptions) ### Description The `HttpsProxyAgent` class implements an `http.Agent` subclass that connects to the specified "HTTP(s) proxy server" in order to proxy HTTPS and/or WebSocket requests. This is achieved by using the HTTP `CONNECT` method. The `proxy` argument is the URL for the proxy server. The `options` argument accepts the usual `http.Agent` constructor options, and some additional properties: * `headers` - Object containing additional headers to send to the proxy server in the `CONNECT` request. ``` -------------------------------- ### HttpsProxyAgent Constructor Source: https://www.npmjs.com/package/https-proxy-agent?activeTab=dependents The HttpsProxyAgent class allows you to create an agent that connects to a specified HTTP or HTTPS proxy server. It's used for proxying HTTPS and WebSocket requests by utilizing the HTTP CONNECT method. You can provide the proxy URL and optional agent options, including custom headers for the CONNECT request. ```APIDOC ## new HttpsProxyAgent(proxy: string | URL, options?: HttpsProxyAgentOptions) ### Description The `HttpsProxyAgent` class implements an `http.Agent` subclass that connects to the specified "HTTP(s) proxy server" in order to proxy HTTPS and/or WebSocket requests. This is achieved by using the HTTP `CONNECT` method. ### Parameters #### Path Parameters - **proxy** (string | URL) - Required - The URL for the proxy server. - **options** (HttpsProxyAgentOptions) - Optional - Accepts the usual `http.Agent` constructor options, and some additional properties: * **headers** (Object) - Object containing additional headers to send to the proxy server in the `CONNECT` request. ``` -------------------------------- ### HttpsProxyAgent Constructor Source: https://www.npmjs.com/package/https-proxy-agent The HttpsProxyAgent class is used to create an agent that connects to a specified HTTP or HTTPS proxy server. It supports additional headers for the CONNECT request. ```APIDOC ## new HttpsProxyAgent(proxy: string | URL, options?: HttpsProxyAgentOptions) ### Description The `HttpsProxyAgent` class implements an `http.Agent` subclass that connects to the specified "HTTP(s) proxy server" in order to proxy HTTPS and/or WebSocket requests. This is achieved by using the HTTP `CONNECT` method. The `proxy` argument is the URL for the proxy server. The `options` argument accepts the usual `http.Agent` constructor options, and some additional properties: * `headers` - Object containing additional headers to send to the proxy server in the `CONNECT` request. ``` -------------------------------- ### HttpsProxyAgent Constructor Source: https://www.npmjs.com/package/https-proxy-agent?activeTab=code The HttpsProxyAgent class allows you to create an agent that connects to a specified HTTP or HTTPS proxy server. It's useful for proxying HTTPS and WebSocket requests using the HTTP CONNECT method. ```APIDOC ## new HttpsProxyAgent(proxy: string | URL, options?: HttpsProxyAgentOptions) ### Description The `HttpsProxyAgent` class implements an `http.Agent` subclass that connects to the specified "HTTP(s) proxy server" in order to proxy HTTPS and/or WebSocket requests. This is achieved by using the HTTP `CONNECT` method. ### Parameters - **proxy** (string | URL) - The URL for the proxy server. - **options** (HttpsProxyAgentOptions) - Optional. Accepts the usual `http.Agent` constructor options, and additional properties: - **headers** (Object) - Object containing additional headers to send to the proxy server in the `CONNECT` request. ``` -------------------------------- ### WebSocket Connection with Proxy Source: https://www.npmjs.com/package/https-proxy-agent?activeTab=dependents Connect to a WebSocket server through a proxy using the ws library. Import HttpsProxyAgent and provide the proxy agent to the WebSocket constructor. ```typescript import WebSocket from 'ws'; import { HttpsProxyAgent } from 'https-proxy-agent'; const agent = new HttpsProxyAgent('http://168.63.76.32:3128'); const socket = new WebSocket('ws://echo.websocket.org', { agent }); socket.on('open', function () { console.log('"open" event!'); socket.send('hello world'); }); socket.on('message', function (data, flags) { console.log('"message" event! %j %j', data, flags); socket.close(); }); ``` -------------------------------- ### Node.js HTTPS Request with Proxy Source: https://www.npmjs.com/package/https-proxy-agent?activeTab=dependents Use this snippet to make an HTTPS request through a proxy server using Node.js's built-in https module. Ensure HttpsProxyAgent is imported. ```typescript import * as https from 'https'; import { HttpsProxyAgent } from 'https-proxy-agent'; const agent = new HttpsProxyAgent('http://168.63.76.32:3128'); https.get('https://example.com', { agent }, (res) => { console.log('"response" event!', res.headers); res.pipe(process.stdout); }); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.