Axios HTTP Client with HTTPS Proxy Fix (Abandoned Fork)
This package, `axios-https-proxy-fix`, is an unmaintained fork of the popular `axios` promise-based HTTP client, specifically created to address a known bug in older `axios` versions. The original issue caused an 'ERR_BAD_PROTOCOL' or '403' error when attempting to make HTTPS requests through an HTTP proxy. It ships with version `0.17.1`, last published in December 2017. As an old fork, it lacks the features, performance improvements, and security patches present in the actively maintained official `axios` library (which is currently in its `1.x` and later versions and has evolved its proxy handling). Its primary differentiator was its proxy fix, which is now largely addressed or handled through standard configurations or companion libraries (like `https-proxy-agent`) in modern `axios`.
Common errors
-
Error: tunneling socket could not be established, statusCode=403
cause This error or similar 'ERR_BAD_PROTOCOL' indicates a problem establishing an HTTPS connection through an HTTP proxy, often due to how older Axios versions handled the 'CONNECT' method.fixUpgrade to the official `axios` package (v0.2x or v1.x+). Modern Axios has improved proxy handling. If problems persist, consider using `https-proxy-agent` with Axios's `httpsAgent` option, or ensure your proxy configuration is correct for your proxy server and `axios` version. -
Property 'someNewAxiosFeature' does not exist on type 'AxiosInstance'.
cause Attempting to use features or configurations introduced in newer versions of the official `axios` library with the outdated `axios-https-proxy-fix` fork.fixReplace `axios-https-proxy-fix` with the current stable `axios` package (`npm install axios`). Features are backported to forks only if actively maintained, which this one is not. -
ModuleNotFoundError: No module named 'axios-https-proxy-fix'
cause The package was not installed or is not resolvable in the current environment.fixEnsure the package is installed via `npm install axios-https-proxy-fix` or update your import paths to use the official `axios` package after migrating.
Warnings
- breaking This package is an abandoned fork of Axios version 0.17.1 (released December 2017). It is incompatible with modern Axios (v0.20+ and v1.x+) and lacks numerous features, bug fixes, and performance improvements present in the actively maintained official `axios` library. Do not use for new projects.
- deprecated The `axios-https-proxy-fix` package is no longer maintained. Its last update was in 2017, meaning it will not receive security updates, bug fixes, or compatibility enhancements. Using unmaintained software introduces significant risks.
- gotcha Using this outdated package exposes applications to potential security vulnerabilities. It lacks years of security patches and best practices implemented in the main `axios` project. This includes vulnerabilities related to HTTP request handling, data parsing, and network interactions.
- gotcha The TypeScript type definitions included with this package are based on an ancient version of Axios. They will not reflect the API changes and new features introduced in `axios` v0.20 and especially v1.x, leading to type errors and incorrect IntelliSense if used in a modern TypeScript project.
Install
-
npm install axios-https-proxy-fix -
yarn add axios-https-proxy-fix -
pnpm add axios-https-proxy-fix
Imports
- axios
const axios = require('axios-https-proxy-fix');import axios from 'axios-https-proxy-fix';
- AxiosRequestConfig
import type { AxiosRequestConfig } from 'axios-https-proxy-fix'; - AxiosResponse
import type { AxiosResponse } from 'axios-https-proxy-fix';
Quickstart
import axios from 'axios-https-proxy-fix';
// Configure Axios with a proxy (example for an HTTP proxy handling HTTPS traffic)
// In a real application, replace with actual proxy details and consider environment variables
const instance = axios.create({
baseURL: 'https://jsonplaceholder.typicode.com',
timeout: 5000,
proxy: {
protocol: 'http',
host: 'your.proxy.host',
port: 8080,
auth: {
username: process.env.PROXY_USERNAME ?? '',
password: process.env.PROXY_PASSWORD ?? ''
}
}
});
// Make a GET request using the configured instance
instance.get('/todos/1')
.then(response => {
console.log('Fetched data:', response.data);
console.log('Status:', response.status);
})
.catch(error => {
if (error.response) {
console.error('Request failed with status:', error.response.status);
console.error('Response data:', error.response.data);
} else if (error.request) {
console.error('No response received:', error.request);
} else {
console.error('Error setting up request:', error.message);
}
});
// Perform a POST request directly without instance (using default global config)
axios.post('https://jsonplaceholder.typicode.com/posts', {
title: 'foo',
body: 'bar',
userId: 1,
}, {
proxy: {
protocol: 'http',
host: 'another.proxy.host',
port: 3128
}
})
.then(response => {
console.log('Posted data:', response.data);
})
.catch(error => {
console.error('POST error:', error.message);
});