Registry / networking / axios-https-proxy

axios-https-proxy

JSON →
library0.1.1jsnpmunverified

An axios interceptor that enables HTTPS requests through an HTTP proxy using the CONNECT method. Current stable version is 0.1.1, with no recent updates (last release appears to be around 2018). It works by adding a request interceptor to axios instances. Differentiators: lightweight, simple API, supports isomorphic use via browser field in package.json. However, it only supports HTTPS over HTTP proxy, not HTTPS proxy itself. It requires axios ^0.18.0 as a peer dependency, which is a very old version.

npm install axios-https-proxy
INSTALL
IMPORT
SIG · AXIOS-HTTPS-PROXY
A
axios-https-proxy
networkingjavascriptv0.1.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

axiosHttpsProxy
const axiosHttpsProxy = require('axios-https-proxy')
import axiosHttpsProxy from 'axios-https-proxy'
The package is not ESM; use require() in Node.js. If you need ESM, you may need to use a bundler or dynamic import.
default
const axiosHttpsProxy = require('axios-https-proxy')
const { axiosHttpsProxy } = require('axios-https-proxy')
No named exports; the default export is the interceptor function.
axios.interceptors.request.use
axios.interceptors.request.use(require('axios-https-proxy'))
axios.interceptors.response.use(require('axios-https-proxy'))
This interceptor is meant for request, not response. Using it in response interceptor will break.

Shows how to require and use the axios-https-proxy interceptor with axios to enable HTTPS requests through an HTTP proxy.

const axios = require('axios'); const axiosHttpsProxy = require('axios-https-proxy'); // Register the interceptor before any request axios.interceptors.request.use(axiosHttpsProxy); // Now make an HTTPS request through an HTTP proxy // Set proxy environment variables or use axios defaults // For example: // process.env.HTTP_PROXY = 'http://proxy.example.com:8080'; axios.get('https://api.example.com/data') .then(response => console.log(response.data)) .catch(error => console.error(error));
Debug
Known issues
deprecatedThis package is unmaintained and relies on a very old version of axios (^0.18.0). It may not work with modern axios versions (>=0.19.0).
fix
Use a more modern proxy solution like 'https-proxy-agent' or 'tunnel' with axios, or upgrade to axios 1.x and use built-in proxy support.
affects: >=0.1.1
gotchaOnly HTTPS requests through an HTTP proxy (CONNECT) are supported. HTTP requests to HTTP proxy are not handled.
fix
For HTTP targets, use axios's built-in proxy configuration or another library.
affects: >=0.0.0
breakingThe interceptor expects proxy settings from environment variables (HTTP_PROXY, HTTPS_PROXY, NO_PROXY). Improperly set or missing environment variables will cause requests to fail or bypass proxy.
fix
Set environment variables or manually configure axios.defaults.proxy before using the interceptor.
affects: >=0.0.0
gotchaIf you use axios with a response interceptor that expects a different format, this interceptor may intercept the request and cause unexpected behavior.
fix
Ensure that the order of interceptors is correct. This interceptor should be added first.
affects: >=0.0.0
deprecatedThe package uses 'follow-redirects' internally, which is outdated. This may cause compatibility issues with newer Node.js versions.
fix
Use a library that doesn't rely on follow-redirects, e.g., 'https-proxy-agent'.
affects: >=0.0.0
Errors
Common errors & fixes
Error: tunneling socket could not be established, cause=socket hang up
The proxy server is not reachable or refused the connection.
fix
Check proxy URL and port, ensure proxy is running and accessible from your network.
TypeError: axios_https_proxy is not a function
Importing the module incorrectly (e.g., using ES import syntax when the package is CJS-only or vice versa).
fix
Use require('axios-https-proxy') in Node.js, or if using ES modules, use createRequire or dynamic import.
Error: Invalid protocol: https
The interceptor is not configured or proxy not set for HTTPS requests.
fix
Set process.env.HTTP_PROXY or axios.defaults.proxy to an HTTP proxy address.
Upgrade
Version history
0.1.1latest on npm
Audit
Dependencies
axiosrequiredpeer dependency: required as the HTTP client that this interceptor extends
Agent activity
33 hits · last 30 days
node
30
OpenAI (training)
1
Resources
axios-https-proxy — npm install axios-https-proxy · libregistry