[Vuejs]-Not able to set proxy port in my vue js app

1๐Ÿ‘

I encountered this problem, solved it by replacing localhost with 127.0.0.1, then with [::1]

A few months later, i had to go back to 127.0.0.1โ€ฆ
Maybe did some process change my hosts file.

You should type ping localhost in your terminal in order to check your current configuration and use the result to set your proxy.

๐Ÿ‘คDr Fred

0๐Ÿ‘

Try this

module.exports = { 
  devServer: { 
    proxy: { 
      '/api': { 
        target: 'http://localhost:3001', 
        ws: true, 
        secure: false 
      } 
    } 
  } 
}

Also, check whether you have set a base path for axios. If so, please remove api from the axios call since base path will also get added to the axios call.

๐Ÿ‘คNish Ganesh

Leave a comment