The value of axios.defaults.xsrfHeaderName is ignored by Axios v1.13.5 (at least in my project), this version is now included in the latest version of InertiaJS (v2.3.16).
While this might be an issue with Axios, there is another simple workaround to get it working, without waiting for Axios to fix this. Maybe this could be added to the docs?
We can configure the default visit options in the createInertiaApp call and set the "X-CSRFTOKEN" header:
createInertiaApp({
...
defaults: {
visitOptions: (href, options) => {
return {
headers: {
...options.headers,
"X-CSRFTOKEN": window.cookie.csrftoken,
},
};
},
}
}