axios-proxy-builder is a focused utility designed to generate Axios-compatible proxy configuration objects by interpreting standard HTTP/HTTPS proxy environment variables, including `HTTP_PROXY`, `HTTPS_PROXY`, and `NO_PROXY`. Currently at version 0.1.2, this package provides a single `configureProxy` function. Its `no-proxy` exclusion logic is notably inspired by the robust implementation found in the now-deprecated `request` library. This tool simplifies proxy integration for Axios in Node.js environments, particularly where proxy settings are managed via system environment variables. While it's in early development, indicated by its 0.x.x versioning, it offers a specific and streamlined solution. The release cadence is likely infrequent, driven by user feedback or minor enhancements rather than a fixed schedule. It differentiates itself from manually configuring Axios proxies by abstracting the parsing of common proxy environment variables, making it a 'set and forget' solution for many common proxy use cases.
npm install axios-proxy-builderVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to configure standard HTTP proxy environment variables and then use `configureProxy` to apply the detected proxy settings to an Axios GET request.
Monitor GitHub repository for updates and breaking changes before upgrading. Consider pinning to exact versions in production.
Verify environment variables are properly defined for the Node.js process. On Linux/macOS, use `export VAR=value`; on Windows, use `set VAR=value` or configure system-wide. Always check `process.env` in your application if unsure.
Carefully review the `NO_PROXY` documentation (often following `request` library's logic). Test `configureProxy` with various `NO_PROXY` values to ensure desired behavior. Ensure full domain names are listed where appropriate, e.g., `example.com` not just `example`.
If SOCKS proxies are required, you will need to manually configure Axios with an appropriate agent (e.g., `httpsAgent` or `httpAgent`) and set `proxy: false` to prevent Axios from automatically using environment variables for HTTP/HTTPS proxies. `axios-proxy-builder` is not suitable for SOCKS proxy configuration.
1. Verify your `HTTP_PROXY`/`HTTPS_PROXY` environment variables are correctly formatted and point to a running, accessible proxy server. 2. Check network connectivity (e.g., `ping` or `curl`) from your application's host to the proxy server. 3. Ensure any required proxy authentication (if supported via URL in env var) is correct.
Review your proxy environment variables. Ensure they start with a valid protocol, e.g., `export HTTP_PROXY="http://proxy.example.com:8080"`.
Install Axios (`npm install axios`) and ensure you import it in your code using `import axios from 'axios';` or `const axios = require('axios');`.If your proxy requires authentication, include the username and password directly in the proxy environment variable URL (e.g., `http://user:pass@proxy.example.com:8080`). Ensure these credentials are correct.