在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML/ Vue cli跨域問題。

Vue cli跨域問題。

A.我要請求的地址:

http://qq1.aaa.com:8080/qqGroups/info 

B.
1.webpack里配置如下

    proxyTable: {
        '/api': {
            target: 'http://qq1.aaa.com:8080',
            changeOrigin: true,
            pathRewrite: {
                '^/api': ''
            }
        }
    },

2.請求

    this.$axios.get('/api/qqGroups/info').then(function(response) {
        console.log(response);
    }).catch(function(error) {
        console.log(error);
    });

3.GET http://localhost:8080/api/qqGroups/info 404 (Not Found)

提示可見 配置無效
C:https://vuejs-templates.githu...

官方文檔也是這么配置的啊
簡直日了方圓500里的狗,搭的新環(huán)境都不行
回答
編輯回答
喵小咪

粗略一看應(yīng)該是沒問題的,你可以先確定一下是否是以下問題:
1、請求服務(wù)器自己能不能調(diào)用這個接口
2、請求服務(wù)器是否開了防火墻

2017年12月14日 17:41
編輯回答
安于心

配置有點問題,應(yīng)該是這樣,望采納
更改:

proxyTable: {
        '/api': {
            target: 'http://qq1.aaa.com:8080',
            changeOrigin: true,
            pathRewrite: function (path, req) { return path.replace(/^\/api/, '') }
        }
    }
2017年1月28日 15:21
編輯回答
故人嘆
pathRewrite: {
    '^/api': '/'
}
2018年4月24日 17:53
編輯回答
久舊酒
pathRewrite: {
  '^/api': '/api'
}
2018年5月13日 20:40