使用vue-cli 2.9
创建的项目
config/index.js
proxyTable: { '/UTRY':{ target:'http://192.168.0.143:9300', changeOrigin:true, pathRewrite:{ '^/UTRY':'/UTRY' } } }
build/webpack.dev.conf.js
devServer:{ proxy: config.dev.proxyTable, }
axios
const baseURL = "http://192.168.0.143:9300"const $http = axios.create({ baseURL })
xxx.vue
this.$http .post("/UTRY/tsupport_workbench/rest/loginCtrl/getMenu")
重启,删除node_modules都试过了,并没有任何代理迹象。。。
控制台还是报跨域
Access to XMLHttpRequest at 'http://192.168.0.143:9300/UTRY/tsupport_workbench/rest/loginCtrl/getMenu' from origin 'http://127.0.0.1:8080' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Network
Request URL: http://192.168.0.143:9300/UTRY/tsupport_workbench/rest/loginCtrl/getMenu
请问该如何配置呢?
相关分类