HTTPS
new https.Agent()
Creates a connection manager for native HTTPS requests, including TLS settings. Keep certificate verification enabled and separate agents where trust configuration differs. The example verifies configuration only; it performs no TLS connection. Tested on Node.js 22.16.0. Example output (one line per entry): ["true 2 true"].
Formal Syntax & Structure
nodejs syntaxnodejs
new https.Agent([options])Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| options | object | HTTP agent settings and TLS connection options. |
Return Value
https.Agent
HTTPS connection manager.
Working Example
Example Snippetnodejs
import https from 'node:https';const agent = new https.Agent({ keepAlive: true, maxSockets: 2, rejectUnauthorized: true });try { console.log(agent.keepAlive, agent.maxSockets, agent.options.rejectUnauthorized);}finally { agent.destroy();}