M
M
mrdragon90002019-07-19 19:18:24
JavaScript
mrdragon9000, 2019-07-19 19:18:24

Why does the browser make a request for a url without a domain when requesting a url without an explicit domain?

I'm making an app with laravel + Vuejs. For ajax-a I use Axios.
Everywhere for axios I specify the address from the root, for example axios.get('/v1/users'). Logically, the browser should make a request relative to the current domain, but it makes a request to this address: http:// v1/users . This doesn't happen all the time, but once in a while. I can't even imagine what it could be. Any ideas?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Derepko, 2019-07-19
@xEpozZ

https://github.com/axios/axios#global-axios-defaults

axios.defaults.baseURL = 'https://api.example.com';

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question