uni-app icon indicating copy to clipboard operation
uni-app copied to clipboard

请求添加proxy代理功能

Open zhe-he opened this issue 7 years ago • 2 comments

新功能描述 简洁描述你希望补充完善的增强功能 本地开发H5的时候,请求接口会存在跨域,能否加一个

proxyTable: {
      "/api": {
        target: "http://xxx.com",
        // secure: true,
        cookieDomainRewrite: "localhost:8080",
        changeOrigin: true,
        pathRewrite: {
          "^/api": "/api"
        }
      }
    },

尝试方案 目前用的fiddler/charles解决的

zhe-he avatar Jun 13 '19 04:06 zhe-he

manifest.json h5配置下面是可以配置 跨域的 "h5": { "title": "", "router": { "mode": "history", "base": "/" }, "devServer": { "https": false, "port": 8089, "disableHostCheck": true, "proxy": { "/api/*": { "target": "", "changeOrigin": true, "secure": true, "pathRewrite": { "/api": "/" } } } } }

NickBoomBoom avatar Jun 13 '19 09:06 NickBoomBoom

thx 我试试

zhe-he avatar Jun 13 '19 09:06 zhe-he