Axios HTTP Client with HTTPS Proxy Fix (Abandoned Fork)

0.17.1 · abandoned · verified Wed Apr 22

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

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to make GET and POST requests using `axios-https-proxy-fix`, including basic proxy configuration for HTTP proxies handling HTTPS traffic, and error handling.

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);
  });

view raw JSON →