1.vue axios跨域請(qǐng)求,后臺(tái)已配置允許跨域,代理訪問的時(shí)候還報(bào)錯(cuò)跨域2.配置了代理訪問地址還是localhostaxios.defaults.headers.common['Access-Control-Allow-Origin'] = "*";axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';proxyTable: { '/apis': { target: 'http://192.168.1.109/xxx/aa', changeOrigin: true, pathRewrite: { '^/apis': '' } }}this.$http.post('/apis/bbb/cccc', { json:JSON.stringify({})}).then(function (response) { console.log(response);}).catch(function (error) { console.log(error);});3.請(qǐng)求結(jié)果報(bào)錯(cuò)Request header field Access-Control-Allow-Origin is not allowed by Access-Control-Allow-Headers in preflight response.Error: Request failed with status code 404at createError (createError.js?16d0:16)at settle (settle.js?db52:18)at XMLHttpRequest.handleLoad (xhr.js?ec6c:77)
Vue axios跨域請(qǐng)求問題
海綿寶寶撒
2019-03-13 13:15:27