nuxt $axios访问多个服务器地址请求数据

  axios: {
    proxy: true,
    retry: { retries: 0 },
  },
  proxy: {  // 上线关闭
    '/ic': {
      target: 'https://www.baidu.cn/',
      secure: false,  // 如果是https接口,需要配置这个参数
      changeOrigin: true,
      pathRewrite: {
        '^/ic': '/ic'
      }
    },
    '/v1': {
      target: 'http://www.youku.com',
      secure: false,  // 如果是https接口,需要配置这个参数
      changeOrigin: true,
      pathRewrite: {
        '^/v1': '/v1'
      }
    }
  },

  

原文地址:https://www.cnblogs.com/qq364735538/p/13295054.html