nuxt操作,代理、请求转发配置

代理、请求转发配置:

nuxt.config.js文件中添加:

  axios: {
    proxy: true, // 需要的,不设置请求无法转发
  },
  proxy: {
    '/api/': {
      target: 'http://127.0.0.1:9000', // 请求得对方地址
      changeOrigin: true,
    },
    '/static/': {
      target: 'http://127.0.0.1:9000',
      changeOrigin: true,
    }
  }

  

posted @ 2021-02-02 18:50  zezhou222  阅读(1466)  评论(0编辑  收藏  举报