Bug with axios.create and baseURL option?
See original GitHub issueFirst let me just say thanks for creating a great little library.
I think I’ve found a bug.
I set my JWT TTL to 60 seconds but the refresh TTL longer so that I can debug this JWT stuff and get it working.
So, I log into my application and then wait > 60 seconds, then I hit an authenticated route /api/auth/me and get a 401.
The interceptor kicks in and hits the refresh token route (/api/auth/refresh), which returns a new token and all that jazz.
After that, I see the original route that triggered the 401 getting hit again… except for one slight problem - It’s hitting /api/api/auth/me. The api part is now doubled.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Setting baseURL in default configuration · Issue #175 - GitHub
This sounds like a bug. I will have to dig in a bit deeper to confirm, but at a glance the code looks...
Read more >Setting baseUrl for Axios in Vue js sends out request
Does anyone know how to cancel this request or is there a better way to set the baseUrl without this 'bug? javascript ·...
Read more >Secure and Easy Axios integration with Nuxt.js.
Automatically set base URL for client & server side. ✓ Exposes setToken function to $axios so we can easily and globally set authentication ......
Read more >Request Config | Axios Docs
These are the available config options for making requests. ... It can be convenient to set `baseURL` for an instance of axios to...
Read more >Understanding Axios POST requests - LogRocket Blog
Sending requests to a web server is one of the most common things we do on the frontend side of web development. Creating...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Resetting the
baseURLworks for the initial failing request but queued requests have the same issue and there is currently no solution to adjust those.IMHO there should be a global
baseURLhandling or a config option to define a callback for queued requests to be able transform their configs too.As I said earlier, I’m not sure if that’s a bug or desired behavior. Either way, it feels like it shouldn’t be like that, so it might be worth opening the issue and see what axios team has to say about it.
If you do so, please, refer to this issue, so anyone with the same problem can see the thread.
Thanks.