nacos-sdk-nodejs icon indicating copy to clipboard operation
nacos-sdk-nodejs copied to clipboard

[直连模式]NacosConfigClient在ssl为true的时候无法连接到https服务

Open smartheye opened this issue 5 years ago • 5 comments

nacos-config/src/http_agent.ts里面有下列代码 // 获取请求 url getRequestUrl(currentServer) { let url; if (/:/.test(currentServer)) { url = http://${currentServer}; if (this.ssl) { url = https://${this.currentServer}; <- 走到这里的时候this.currentServer为undefined,应该采用参数的currentServer。另外this.currentServer一直没有找到设值的地方 } } else { url = http://${currentServer}:${this.serverPort}; if (this.ssl) { url = https://${this.currentServer}:${this.serverPort}; <- 这里有同样问题 } } return ${url}/${this.contextPath}; }

smartheye avatar Jul 20 '19 07:07 smartheye

目前不支持https,之前在调https的时候一直报错-。-

czy88840616 avatar Jul 21 '19 02:07 czy88840616

@czy88840616 不支持https的原因是什么

w724883 avatar Nov 22 '19 13:11 w724883

额。。主要之前一直有个问题没 debug 出来,然后一直也很忙。。如果有需求可以帮忙搞一下 😢

czy88840616 avatar Nov 24 '19 09:11 czy88840616

好像还是不支持https?

gogomarine avatar Sep 25 '20 10:09 gogomarine

@czy88840616 不支持https的原因是什么

我也遇到这个问题,查看了源码,发现是因为this.currentServer没赋值导致的,官方啥时候能发个新版本啊。


// 获取请求 url
  getRequestUrl(currentServer) {
    let url;
    if (/:/.test(currentServer)) {
      url = `http://${currentServer}`;
      if (this.ssl) {
        url = `https://${this.currentServer}`;
      }
    } else {
      url = `http://${currentServer}:${this.serverPort}`;
      if (this.ssl) {
        url = `https://${this.currentServer}:${this.serverPort}`;
      }
    }
    return `${url}/${this.contextPath}`;
  }

this.currentServer从来没有赋值,这边应该是笔误。

image

Hquestion avatar Jan 25 '21 10:01 Hquestion