Change The Default Base Url For Axios
Answer : Instead of this.$axios.get('items') use this.$axios({ url: 'items', baseURL: 'http://new-url.com' }) If you don't pass method: 'XXX' then by default, it will send via get method. Request Config: https://github.com/axios/axios#request-config Putting my two cents here. I wanted to do the same without hardcoding the URL for my specific request. So i came up with this solution. To append 'api' to my baseURL, I have my default baseURL set as, axios.defaults.baseURL = '/api/'; Then in my specific request, after explicitly setting the method and url, i set the baseURL to '/' axios({ method:'post', url:'logout', baseURL: '/', }) .then(response => { window.location.reload(); }) .catch(error => { console.log(error); }); Create .env.development , .env.production files if not exists and add there your API endpoint, for example: VUE_APP_...