TL;DR: Axios set headers across five layers, per-request config, global defaults, axios.create() instances, request and response interceptors, and the response itself. This guide walks each layer with runnable v1 snippets, then fixes the four bugs that bite everyone: multipart boundaries, CORS cookies, self-signed certs, and header casing.Axios is still the default HTTP client most JavaScript and TypeScript teams reach for, and most of the bugs people file against it are not Axios bugs at all. They are header bugs. A misplaced config argument silently drops your Authorization header. A manually typed Content-Type: multipart/form-data corrupts every upload. A global axios.defaults token leaks to every third-party host you happen to call. Each of these has a clean fix once you know where in the request lifecycle the header is supposed to live.
This Axios set headers guide is the playbook I wish I had when wiring up my first interceptor stack. It targets Axios v1 on Node 20+, but the patterns apply to the browser where they differ. You will see per-request headers, global defaults, scoped instances, and request and response interceptors side by side, with a decision rule for choosing between them. You will also get a full Axios response headers section that most tutorials skip, plus a troubleshooting block for the bugs you actually hit in production.




