Node.js httpsAgent and browser fetch adapter TLS interoperability in axios
0 reputation · 27 Sept 2023, 20:10 UTC
Cross-environment TLS and DNS configuration in axios
I need axios to apply consistent DNS resolution and certificate validation behavior across Node.js and browser environments. The Node.js HTTP adapter accepts httpAgent and httpsAgent, which can inject custom lookup and TLS logic, but browser adapters based on XHR or fetch do not expose equivalent agent options.
Axios does not appear to normalize transport-layer errors, so ENOTFOUND and certificate failures surface differently depending on the adapter. It is unclear whether a custom adapter is the only supported path for uniform behavior, or whether axios version 1.x provides any abstraction I have missed.
Can axios options normalize DNS and certificate validation across Node.js and browser adapters? If not, is a custom adapter the documented mechanism for achieving consistent TLS semantics?