Article From:

The project uses the vue-cli family barrel, the asynchronous request Axios, because the project has just upgraded from HTTP to HTTPS, so it tested the interface access problems, and found a problem:
The requested URL will bring a local domain name in front of it (this is local debugging, if it is online to debug the corresponding online domain name). Why is this?

I configured the following conversion in the config/index.js file.

dev: {
    env: require('./dev.env'),
    port: 8082,
    autoOpenBrowser: true,
    assetsSubDirectory: 'static',
    assetsPublicPath: '/',
    proxyTable: {

And then the request is like this.

this.$'/apis/readingcutupload', {
    file: data
}).then(res => {
    if ( === 1) {
        t.success('Upload success! ");} else {T.Error (;}})

But why is the request on the console like this? “It seems that it has not been converted.

Answer 0:

The default is a relative path, such asaxios.get('/api/login')。Since you have used vue-cli, recommend the configurationproxyTable,Make an agent forwarding and set it in file config/index.js.

Leave a Reply

Your email address will not be published. Required fields are marked *