Axios interceptor that replaces synchronous dns.lookup with async dns.resolve, with optional caching and background refresh. Version 3.3.0 targets Node >=14, ships TypeScript types, and uses ESM only. Key differentiators: configurable TTL, idle eviction, round-robin across resolved IPs, and built-in statistics. Designed for Kubernetes/cloud environments where low DNS TTLs overwhelm default synchronous resolution.
npm install axios-cached-dns-resolveNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates an Axios client and registers the DNS caching interceptor with custom TTL and cache size.
Use import syntax; set type: module in package.json or use .mjs extension.
Upgrade to Node 14 or later.
Explicitly pass config object to registerInterceptor() avoid reading env vars.
Call registerInterceptor for each axios.create() instance separately.
In config: logging: { level: 'error' } or disabled: true.Use import syntax: import { registerInterceptor } from 'axios-cached-dns-resolve'Ensure the argument is an Axios instance (created with axios.create()).
Check network connectivity, or disable cache with { disabled: true } to fall back to default lookup.