axios-proxy-fix
raw JSON → 0.16.3 verified Fri May 01 auth: no javascript abandoned
A fork of axios (Promise based HTTP client for browser and Node.js) with proxy support fixes. v0.16.3 is a legacy version based on axios 0.16.x, which is no longer actively maintained. Note that the original axios is at v1.x and has breaking changes from v0.x. This fork is not the official axios and may have diverged. Use official axios for modern projects.
Common errors
error Cannot read property 'protocol' of undefined ↓
cause Proxy configuration missing or incorrectly set in axios options.
fix
Ensure proxy object has host and port properties: proxy: { host: 'localhost', port: 8080 }
error TypeError: adapter is not a function ↓
cause Mismatch between axios version and adapter (e.g., in React Native or testing).
fix
Use official axios and set adapter explicitly if needed: adapter: require('axios/lib/adapters/http')
error Uncaught TypeError: Cannot read properties of null (reading 'status') ↓
cause Response object is null, often due to network error (e.g., DNS failure) not handled.
fix
Add error handling that checks error.response: if (error.response) { ... } else { ... }
Warnings
gotcha This is a fork of the original axios, not maintained by axios team. Proxy fixes may not be in official axios. Use at your own risk. ↓
fix Consider using official axios with manual proxy configuration, or use http-proxy-agent and https-proxy-agent.
breaking axios v0.x to v1.x has breaking changes: request/response interceptors signature, cancellation with AbortController, etc. This fork is based on v0.16.x. ↓
fix Do not mix axios v1.x and v0.x. Use consistent version.
deprecated axios-proxy-fix v0.16.3 is outdated. No further updates likely. Consider migrating to official axios v1.x. ↓
fix Run: npm uninstall axios-proxy-fix && npm install axios@latest
Install
npm install axios-proxy-fix yarn add axios-proxy-fix pnpm add axios-proxy-fix Imports
- axios wrong
const axios = require('axios-proxy-fix')correctimport axios from 'axios-proxy-fix' - AxiosInstance wrong
import { AxiosInstance } from 'axios-proxy-fix'correctimport type { AxiosInstance } from 'axios-proxy-fix' - AxiosResponse wrong
import AxiosResponse from 'axios-proxy-fix'correctimport type { AxiosResponse } from 'axios-proxy-fix'
Quickstart
import axios from 'axios-proxy-fix';
// Make a GET request
axios.get('/user?ID=12345')
.then(function (response) {
console.log(response.data);
})
.catch(function (error) {
console.log(error);
});
// POST request
axios.post('/user', { firstName: 'Fred', lastName: 'Flintstone' })
.then(response => console.log(response))
.catch(error => console.log(error));
// Using axios config
axios({
method: 'get',
url: 'https://api.example.com/data',
params: { key: 'value' }
}).then(response => {
console.log(response.data);
});