A Node.js library to configure a global HTTP/HTTPS proxy agent using environment variables.
global-agent is a Node.js library that configures a global HTTP/HTTPS proxy agent using environment variables. It solves the problem of routing all HTTP/HTTPS traffic from a Node.js application through a proxy without requiring changes to individual HTTP client libraries or request configurations.
Node.js developers and DevOps engineers who need to configure proxy settings for applications in environments like corporate networks, testing setups, or deployment pipelines.
Developers choose global-agent for its simplicity, broad compatibility with HTTP libraries, and environment-driven configuration that eliminates the need for manual proxy setup in each HTTP client.
Global HTTP/HTTPS proxy agent configurable using environment variables.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Configures proxies using standard environment variables like GLOBAL_AGENT_HTTP_PROXY, enabling setup without code changes as shown in the bootstrap usage, ideal for Docker and CI/CD pipelines.
Works with any library using Node.js's http.request, including got, axios, and request, ensuring it intercepts traffic from popular HTTP clients without modifications.
Allows proxy settings to be changed at runtime via global.GLOBAL_AGENT, facilitating testing and debugging without application restarts, as demonstrated in the runtime configuration examples.
Supports NO_PROXY patterns with wildcards for domain exclusions and separate HTTPS proxy configuration via GLOBAL_AGENT_HTTPS_PROXY, providing fine-grained traffic routing.
Only supports Node.js v10 and above, making it incompatible with older systems without upgrades, as admitted in the conditional bootstrap example comparing to global-tunnel-ng.
Default behavior aggressively overrides custom HTTP agents, which can break libraries like Stripe SDK that rely on specific agent setups, requiring explicit GLOBAL_AGENT_FORCE_GLOBAL_AGENT=false to disable.
Conditional initialization or custom logging requires manual handling of bootstrap routines or API calls, adding overhead compared to simpler, drop-in proxy solutions.