forked from lobehub/lobe-chat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main'
- Loading branch information
Showing
17 changed files
with
277 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: '🐛 反馈缺陷' | ||
description: '反馈一个问题缺陷' | ||
title: '[Bug] ' | ||
labels: ['🐛 Bug'] | ||
body: | ||
- type: dropdown | ||
attributes: | ||
label: '💻 系统环境' | ||
options: | ||
- Windows | ||
- macOS | ||
- Ubuntu | ||
- Other Linux | ||
- iOS | ||
- Android | ||
- Other | ||
validations: | ||
required: true | ||
|
||
- type: dropdown | ||
attributes: | ||
label: '📦 部署环境' | ||
options: | ||
- Official Preview | ||
- Vercel / Zeabur / Sealos | ||
- Docker | ||
- Other | ||
validations: | ||
required: true | ||
|
||
- type: dropdown | ||
attributes: | ||
label: '🌐 浏览器' | ||
options: | ||
- Chrome | ||
- Edge | ||
- Safari | ||
- Firefox | ||
- Other | ||
validations: | ||
required: true | ||
- type: textarea | ||
attributes: | ||
label: '🐛 问题描述' | ||
description: 请提供一个清晰且简洁的问题描述。 | ||
validations: | ||
required: true | ||
- type: textarea | ||
attributes: | ||
label: '🚦 期望结果' | ||
description: 请提供一个清晰且简洁的描述,说明您期望发生什么。 | ||
- type: textarea | ||
attributes: | ||
label: '📷 复现步骤' | ||
description: 请提供一个清晰且简洁的描述,说明如何复现问题。 | ||
- type: textarea | ||
attributes: | ||
label: '📝 补充信息' | ||
description: 如果您的问题需要进一步说明,或者您遇到的问题无法在一个简单的示例中复现,请在这里添加更多信息。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
name: '🌠 功能需求 Feature Request' | ||
description: '需求或建议 | Suggest an idea' | ||
name: '🌠 Feature Request' | ||
description: 'Suggest an idea' | ||
title: '[Request] ' | ||
labels: '🌠 Feature Request' | ||
labels: ['🌠 Feature Request'] | ||
body: | ||
- type: textarea | ||
attributes: | ||
label: '🥰 需求描述 | Feature Description' | ||
label: '🥰 Feature Description' | ||
description: Please add a clear and concise description of the problem you are seeking to solve with this feature request. | ||
validations: | ||
required: true | ||
- type: textarea | ||
attributes: | ||
label: '🧐 解决方案 | Proposed Solution' | ||
label: '🧐 Proposed Solution' | ||
description: Describe the solution you'd like in a clear and concise manner. | ||
validations: | ||
required: true | ||
- type: textarea | ||
attributes: | ||
label: '📝 补充信息 | Additional Information' | ||
label: '📝 Additional Information' | ||
description: Add any other context about the problem here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: '🌠 功能需求' | ||
description: '提出需求或建议' | ||
title: '[Request] ' | ||
labels: ['🌠 功能需求'] | ||
body: | ||
- type: textarea | ||
attributes: | ||
label: '🥰 需求描述' | ||
description: 请添加一个清晰且简洁的问题描述,阐述您希望通过这个功能需求解决的问题。 | ||
validations: | ||
required: true | ||
- type: textarea | ||
attributes: | ||
label: '🧐 解决方案' | ||
description: 请清晰且简洁地描述您想要的解决方案。 | ||
validations: | ||
required: true | ||
- type: textarea | ||
attributes: | ||
label: '📝 补充信息' | ||
description: 在这里添加关于问题的任何其他背景信息。 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
contact_links: | ||
- name: Questions and ideas | 问题和想法 | ||
url: https://github.com/lobehub/lobe-chat/discussions/new/choose | ||
about: Please post questions, and ideas in discussions. | 请在讨论区发布问题和想法。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Frequently Asked Questions | ||
|
||
## When using a proxy(e.g. Surge), I encounter the `UNABLE_TO_VERIFY_LEAF_SIGNATURE` error | ||
|
||
### Problem Description | ||
|
||
When making network requests during private deployment, certificate validation errors may occur. The error messages may be as follows: | ||
|
||
``` | ||
[TypeError: fetch failed] { | ||
cause: [Error: unable to verify the first certificate] { | ||
code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE' | ||
} | ||
} | ||
``` | ||
|
||
Or: | ||
|
||
``` | ||
{ | ||
"endpoint": "https://api.openai.com/v1", | ||
"error": { | ||
"cause": { | ||
"code": "UNABLE_TO_VERIFY_LEAF_SIGNATURE" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
This problem typically occurs when using a proxy server with a self-signed certificate or a man-in-the-middle certificate that is not trusted by Node.js by default. | ||
|
||
### Solution | ||
|
||
To resolve this issue, you can add an environment variable to bypass Node.js certificate validation when starting the application. The specific approach is to include `NODE_TLS_REJECT_UNAUTHORIZED=0` in the startup command. For example: | ||
|
||
```bash | ||
NODE_TLS_REJECT_UNAUTHORIZED=0 npm run start | ||
``` | ||
|
||
Alternatively, when running in a Docker container, you can set the environment variable in the Dockerfile or docker-compose.yml: | ||
|
||
```dockerfile | ||
# In the Dockerfile | ||
ENV NODE_TLS_REJECT_UNAUTHORIZED=0 | ||
``` | ||
|
||
```yaml | ||
# In the docker-compose.yml | ||
environment: | ||
- NODE_TLS_REJECT_UNAUTHORIZED=0 | ||
``` | ||
Example Docker run command: | ||
```bash | ||
docker run -e NODE_TLS_REJECT_UNAUTHORIZED=0 <other parameters> <image name> | ||
``` | ||
|
||
Please note that this method reduces security because it allows Node.js to accept unverified certificates. Therefore, it is only recommended for use in private deployments with fully trusted network environments, and the default certificate validation settings should be restored after resolving the certificate issue. | ||
|
||
### More Secure Alternatives | ||
|
||
If possible, it is recommended to address certificate issues using the following methods: | ||
|
||
1. Ensure that all man-in-the-middle certificates are correctly installed on the proxy server and the corresponding clients. | ||
2. Replace self-signed or man-in-the-middle certificates with valid certificates issued by trusted certificate authorities. | ||
3. Properly configure the certificate chain in the code to ensure that Node.js can validate to the root certificate. | ||
|
||
Implementing these methods can resolve certificate validation issues without sacrificing security. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# 常见问题 | ||
|
||
## 使用代理中转请求时(例如:Surge),报 `UNABLE_TO_VERIFY_LEAF_SIGNATURE` 错误 | ||
|
||
### 问题描述 | ||
|
||
在私有化部署时,进行网络请求可能会遇到证书验证错误。错误信息可能如下: | ||
|
||
``` | ||
[TypeError: fetch failed] { | ||
cause: [Error: unable to verify the first certificate] { | ||
code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE' | ||
} | ||
} | ||
``` | ||
|
||
或者是: | ||
|
||
``` | ||
{ | ||
"endpoint": "https://api.openai.com/v1", | ||
"error": { | ||
"cause": { | ||
"code": "UNABLE_TO_VERIFY_LEAF_SIGNATURE" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
这个问题通常出现在使用代理服务器时,代理服务器使用的自签名证书或中间人证书不被 Node.js 默认信任。 | ||
|
||
### 解决方案 | ||
|
||
要解决这个问题,可以在启动应用时添加环境变量,跳过 Node.js 的证书验证。具体做法是在启动命令中加入 `NODE_TLS_REJECT_UNAUTHORIZED=0`。例如: | ||
|
||
```bash | ||
NODE_TLS_REJECT_UNAUTHORIZED=0 npm run start | ||
``` | ||
|
||
或者在 Docker 容器中运行时,可以在 Dockerfile 或者 docker-compose.yml 中设置环境变量: | ||
|
||
```dockerfile | ||
# 在 Dockerfile 中 | ||
ENV NODE_TLS_REJECT_UNAUTHORIZED=0 | ||
``` | ||
|
||
```yaml | ||
# 在 docker-compose.yml 中 | ||
environment: | ||
- NODE_TLS_REJECT_UNAUTHORIZED=0 | ||
``` | ||
Docker 运行命令示例: | ||
```bash | ||
docker run -e NODE_TLS_REJECT_UNAUTHORIZED=0 <其他参数> <镜像名> | ||
``` | ||
|
||
请注意,这种方法会降低安全性,因为它允许 Node.js 接受未经验证的证书。因此,仅建议在完全信任网络环境的私有化部署中使用,且需要在解决证书问题后恢复默认的证书验证设置。 | ||
|
||
### 更安全的替代方案 | ||
|
||
如果可能,建议通过以下方法解决证书问题: | ||
|
||
1. 确保所有的中间人证书都被正确地安装在代理服务器和相应的客户端上。 | ||
2. 使用有效的、由受信任的证书颁发机构签发的证书替换自签名或中间人证书。 | ||
3. 在代码中正确配置证书链,确保 Node.js 可以验证到根证书。 | ||
|
||
采用这些方法可以在不牺牲安全性的前提下解决证书验证问题。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.