[Vuejs]-Vue.js – proxy in vue.config.js is being ignored

0👍

Your axios call is going to make the request to the API with whatever protocol the webpage is on.

The error shows that you’re making an http call but your webpack config is only spoofing https. Are you visiting https from the page making the request?

Eg https://localhost:8080

You can also try updating your webpack proxy server to look like this

module.exports = {
  //...
  devServer: {
    proxy: {
      '/api': {
        target: 'https://other-server.example.com',
        secure: false
      }
    }
  }
};

Additional debug steps: curl your Api endpoint from your terminal to see if it’s a protocol issue

👤Jess

-1👍

you can try

https: true,

proxy: {
            '/api': {
                target: 'https://localhost/',
                ws: true,
                changeOrigin: true
            }
        }

before try, restart by npm run serve to make it sense

Leave a comment