首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Loopback4使用自签名证书调用HTTPS/REST服务

Loopback4使用自签名证书调用HTTPS/REST服务
EN

Stack Overflow用户
提问于 2020-10-09 20:20:25
回答 1查看 50关注 0票数 1

如何在带有OpenApi连接器的Loopback4中使用自签名证书调用https/rest终结点?是否有允许此类证书的选项?

当我尝试调用service.operation()时,我得到了以下异常:

代码语言:javascript
运行
复制
Unhandled error in GET /user/8f9d1e34-c340-4ebe-af11-fa0c4575f676: 500 FetchError: request to https://localhost:8243/scim2/1.0.0/Users/8f9d1e34-c340-4ebe-af11-fa0c4575f676 failed, reason: unable to verify the first certificate
    at ClientRequest.<anonymous> (D:\DEV_BTC\GIT\Foton\PIX\application\composite-services\perfil-usuario-ms\node_modules\node-fetch\lib\index.js:1461:11)
    at ClientRequest.emit (events.js:315:20)
    at TLSSocket.socketErrorListener (_http_client.js:426:9)
    at TLSSocket.emit (events.js:315:20)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)

REST Connector的文档提到了一个名为"strictSSL": false的参数,它允许使用自签名的SSL证书。有没有类似于OpenAPI连接器的东西?

谢谢!

EN

回答 1

Stack Overflow用户

发布于 2020-10-11 18:22:32

在打开一个变成问题的bug报告之后,Loopback的团队创建了一个新版本的loopback-connector-openapi to handle this option

基本上,您需要将此选项添加到数据源config

代码语言:javascript
运行
复制
const config = {
  (...)
  httpClientOptions: {
    agent: new https.Agent({rejectUnauthorized: false}),
  }
  (...)
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64279939

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档