好儿郎
好儿郎
  • 发布:2021-10-16 17:17
  • 更新:2021-10-18 13:27
  • 阅读:1009

【报Bug】hbuilder X 3.2.9 unicloud 配置devServer没生效

分类:uniCloud

产品分类: uniCloud/App

操作步骤:

在unicloud项目的manifest.json里配置derServer,

"proxy" : {
"/api" : {
// 这个是你要替换的位置
"target" : "https://api.weixin.qq.com/cgi-bin/token", //这个是被替换的目标地址
"changeOrigin" : true, // 是否需要跨域
"pathRewrite" : {
"^/api":"/"
}
},
}

预期结果:

识别带/api的请求然后进行代理

实际结果:

返回报错信息
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><title>Error</title></head><body>

<pre>Cannot GET /api</pre>

</body></html>

bug描述:

在manifest.json里配置derServer后,并没有生效,

不管是配置了devServer,还是注释掉devServer,控制器报错信息均一致。

报错信息
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><title>Error</title></head><body>

<pre>Cannot GET /api</pre>

</body></html>

2021-10-16 17:17 负责人:无 分享
已邀请:
DCloud_uniCloud_WYQ

DCloud_uniCloud_WYQ

"proxy": {  
        "/api": {  
          "target": "https://api.weixin.qq.com",  
          "pathRewrite": {  
            "/api/cgi-bin/token": "/cgi-bin/token"  
          },  
          "changeOrigin": true  
        }  
      }

target只写协议加域名

该问题目前已经被锁定, 无法添加新回复