📝 docs: restore S3_PUBLIC_DOMAIN in deployment guides

The S3_PUBLIC_DOMAIN env var was incorrectly removed from all
documentation in commit 4a87b31. This variable is still required
by the code (src/server/services/file/impls/s3.ts) to generate
public URLs for uploaded files. Without it, image URLs sent to
vision models are just S3 keys instead of full URLs.

Closes #12161
This commit is contained in:
YuTengjing
2026-02-07 20:51:55 +08:00
parent 2fd3d4df0f
commit 24073f83d3
19 changed files with 76 additions and 0 deletions
+3
View File
@@ -262,6 +262,9 @@ OPENAI_API_KEY=sk-xxxxxxxxx
# Bucket request endpoint
# S3_ENDPOINT=https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxx.r2.cloudflarestorage.com
# Public access domain for the bucket, used to access files in the bucket
# S3_PUBLIC_DOMAIN=https://s3-for-your-bucket.your-domain.com
# Bucket region, such as us-west-1, generally not needed to add
# but some service providers may require configuration
# S3_REGION=us-west-1
+9
View File
@@ -50,6 +50,15 @@ The best practice in this area is to use a file storage service (S3) to store im
Whether to set the ACL to `public-read` when uploading files. This option is enabled by default. If the service provider does not support setting individual ACLs for files (i.e., all files inherit the ACL of the storage bucket), enabling this option may cause request errors. Set `S3_SET_ACL` to `0` to disable it.
### `S3_PUBLIC_DOMAIN`
The public access domain of the storage bucket, used to access files in the storage bucket. This address needs to be **publicly readable**. The reason is that when OpenAI's gpt-4o and other vision models recognize images, OpenAI will try to download this image link on their servers. Therefore, this link must be publicly accessible. If it is a private link, OpenAI will not be able to access the image and thus will not be able to recognize the image content properly.
<Callout type={'warning'}>
Additionally, since this access domain is often a separate URL, it needs to be configured to allow
cross-origin access to the site. Otherwise, cross-origin issues will occur in the browser.
</Callout>
### `S3_ENABLE_PATH_STYLE`
Whether to enable the `path-style` access mode of S3. This option is disabled by default. If your S3 service provider uses `path-style`, set `S3_ENABLE_PATH_STYLE` to `1` to enable it.
+8
View File
@@ -46,6 +46,14 @@ LobeHub 在 [很早以前](https://x.com/lobehub/status/1724289575672291782) 就
是否在上传文件时设置 ACL 为 `public-read`。该选项默认启用。如果服务商不支持为文件设置单独的 ACL(即所有文件继承存储桶的 ACL),启用此选项可能会导致请求错误,将 `S3_SET_ACL` 设置为 `0` 即可关闭。
### `S3_PUBLIC_DOMAIN`
存储桶对外的访问域名,用于访问存储桶中的文件,这个地址需要**允许互联网可读**。 原因是 OpenAI 的 gpt-4o 等视觉模型识别图片时,OpenAI 会尝试在他们的服务器中下载这个图片链接,因此这个链接必须是公开可访问的,如果是私有的链接,OpenAI 将无法访问到这个图片,进而无法正常识别到图片内容。
<Callout type={'warning'}>
此外,由于该访问域名往往是一个独立的网址,因此需要配置允许站点的跨域访问,否则会在浏览器中出现跨域问题。
</Callout>
### `S3_ENABLE_PATH_STYLE`
是否启用 S3 的 `path-style` 访问模式。此选项默认禁用。如果您的 S3 服务提供商使用 `path-style`,请将 `S3_ENABLE_PATH_STYLE` 设置为 `1` 以启用它。
@@ -39,6 +39,8 @@ We need to configure an S3 storage service in the server-side database to store
S3_BUCKET=LobeHub
# Request endpoint of the bucket (note that the path in this link includes the bucket name, which must be removed, or use the link provided on the page for applying S3 API token)
S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
# Access domain of the bucket
S3_PUBLIC_DOMAIN=https://s3-for-LobeHub.your-domain.com
```
<Callout type={'warning'}>
@@ -116,6 +118,9 @@ S3_SECRET_ACCESS_KEY=55af75d8eb6b99f189f6a35f855336ea62cd9c4751a5cf4337c53c1d3f4
S3_BUCKET=LobeHub
# Bucket Request Endpoint
S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
# Public Access Domain for the Bucket
S3_PUBLIC_DOMAIN=https://s3-dev.your-domain.com
# Bucket Region, such as us-west-1. Generally not required, but some service providers may need it.
# S3_REGION=us-west-1
```
@@ -40,6 +40,8 @@ tags:
S3_BUCKET=LobeHub
# 存储桶的请求端点(注意此处链接的路径带存储桶名称,必须删除该路径,或使用申请 S3 API token 页面所提供的链接)
S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
# 存储桶对外的访问域名
S3_PUBLIC_DOMAIN=https://s3-for-LobeHub.your-domain.com
```
<Callout type={'warning'}>`S3_ENDPOINT`必须删除其路径,否则会无法访问所上传文件</Callout>
@@ -113,6 +115,9 @@ S3_SECRET_ACCESS_KEY=55af75d8eb6b99f189f6a35f855336ea62cd9c4751a5cf4337c53c1d3f4
S3_BUCKET=LobeHub
# 存储桶的请求端点
S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
# 存储桶对外的访问域名
S3_PUBLIC_DOMAIN=https://s3-dev.your-domain.com
# 桶的区域,如 us-west-1,一般来说不需要添加,但某些服务商则需要配置
# S3_REGION=us-west-1
```
+2
View File
@@ -135,6 +135,8 @@ We need to configure an S3-compatible storage service in the server-side databas
S3_ENDPOINT=https://lobe-s3-api.example.com
# Bucket name
S3_BUCKET=lobe
# Public domain for accessing the bucket
S3_PUBLIC_DOMAIN=https://lobe-s3-api.example.com
S3_ENABLE_PATH_STYLE=1
```
</Steps>
@@ -135,6 +135,8 @@ tags:
S3_ENDPOINT=https://lobe-s3-api.example.com
# 存储桶的名称
S3_BUCKET=lobe
# 存储桶对外的访问域名
S3_PUBLIC_DOMAIN=https://lobe-s3-api.example.com
S3_ENABLE_PATH_STYLE=1
```
</Steps>
@@ -39,6 +39,7 @@ We need to configure S3 storage service for file storage in the server-side data
S3_BUCKET=lobe-130xxxxxx2
S3_ENDPOINT=https://cos.ap-chengdu.myqcloud.com
S3_REGION=ap-chengdu
S3_PUBLIC_DOMAIN=https://lobe-1251234567.cos.ap-chengdu.myqcloud.com
```
<Callout type={'warning'}>
@@ -40,6 +40,8 @@ tags:
S3_ENDPOINT=https://cos.ap-chengdu.myqcloud.com
# 桶的区域
S3_REGION=ap-chengdu
# 存储桶对外的访问域名
S3_PUBLIC_DOMAIN=https://lobe-1251234567.cos.ap-chengdu.myqcloud.com
```
<Callout type={'warning'}>
@@ -58,6 +58,13 @@ LobeHub supports multimodal AI sessions, including the ability to upload unstruc
- Default: `1`
- Example: `0`
### `S3_PUBLIC_DOMAIN`
- Type: Required
- Description: Public access domain for the bucket, used to access files in the bucket
- Default: -
- Example: `https://files.example.com`
### `S3_ENABLE_PATH_STYLE`
- Type: Optional
@@ -56,6 +56,13 @@ LobeHub 支持多模态的 AI 会话,包括将图片、文件等非结构化
- 默认值:`1`
- 示例:`0`
### `S3_PUBLIC_DOMAIN`
- 类型:必填
- 描述:存储桶对外的访问域名,用于访问存储桶中的文件
- 默认值:-
- 示例:`https://files.example.com`
### `S3_ENABLE_PATH_STYLE`
- 类型:可选
@@ -281,6 +281,7 @@ Now, we will introduce the necessary configurations for running these services:
LobeHub needs to provide a public access URL for object files for the LLM service provider, so you need to configure the S3 Endpoint:
```env
S3_PUBLIC_DOMAIN=https://s3.example.com
S3_ENDPOINT=https://s3.example.com
```
@@ -277,6 +277,7 @@ mv .env.zh-CN.example .env
LobeHub 需要为 LLM 服务提供商提供文件对象的公网访问地址,因此你需要配置 S3 的 Endpoint
```env
S3_PUBLIC_DOMAIN=https://s3.example.com
S3_ENDPOINT=https://s3.example.com
```
+2
View File
@@ -89,6 +89,7 @@ Here is the process for deploying the LobeHub server database version on a Linux
S3_SECRET_ACCESS_KEY=xxxxxxxxxx
S3_ENDPOINT=https://xxxxxxxxxx.r2.cloudflarestorage.com
S3_BUCKET=LobeHub
S3_PUBLIC_DOMAIN=https://s3-for-LobeHub.your-domain.com
```
@@ -145,6 +146,7 @@ $ docker run -it -d --name lobehub -p 3210:3210 \
-e S3_SECRET_ACCESS_KEY=xxxxxxxxxx \
-e S3_ENDPOINT=https://xxxxxxxxxx.r2.cloudflarestorage.com \
-e S3_BUCKET=LobeHub \
-e S3_PUBLIC_DOMAIN=https://s3-for-LobeHub.your-domain.com \
lobehub/lobehub
```
@@ -87,6 +87,8 @@ tags:
# 用于 S3 API 访问的域名
S3_ENDPOINT=https://xxxxxxxxxx.r2.cloudflarestorage.com
S3_BUCKET=LobeHub
# 用于外网访问 S3 的公共域名,需配置 CORS
S3_PUBLIC_DOMAIN=https://s3-for-LobeHub.your-domain.com
# S3_REGION=ap-chengdu # 如果需要指定地域
```
@@ -144,6 +146,7 @@ $ docker run -it -d --name lobehub -p 3210:3210 \
-e S3_SECRET_ACCESS_KEY=xxxxxxxxxx \
-e S3_ENDPOINT=https://xxxxxxxxxx.r2.cloudflarestorage.com \
-e S3_BUCKET=LobeHub \
-e S3_PUBLIC_DOMAIN=https://s3-for-LobeHub.your-domain.com \
lobehub/lobehub
```
+2
View File
@@ -39,6 +39,7 @@ S3_ACCESS_KEY_ID=
S3_SECRET_ACCESS_KEY=
S3_ENDPOINT=
S3_BUCKET=
S3_PUBLIC_DOMAIN=
S3_ENABLE_PATH_STYLE=
```
@@ -117,6 +118,7 @@ S3_ACCESS_KEY_ID=
S3_SECRET_ACCESS_KEY=
S3_ENDPOINT=
S3_BUCKET=
S3_PUBLIC_DOMAIN=
S3_ENABLE_PATH_STYLE=
```
@@ -40,6 +40,7 @@ S3_ACCESS_KEY_ID=
S3_SECRET_ACCESS_KEY=
S3_ENDPOINT=
S3_BUCKET=
S3_PUBLIC_DOMAIN=
S3_ENABLE_PATH_STYLE=
```
@@ -118,6 +119,7 @@ S3_ACCESS_KEY_ID=
S3_SECRET_ACCESS_KEY=
S3_ENDPOINT=
S3_BUCKET=
S3_PUBLIC_DOMAIN=
S3_ENABLE_PATH_STYLE=
```
+7
View File
@@ -154,6 +154,8 @@ In the server-side database, we need to configure the S3 storage service to stor
S3_BUCKET=LobeHub
# Storage bucket request endpoint (note that the path in this link includes the bucket name, which must be removed, or use the link provided on the S3 API token application page)
S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
# Public access domain for the storage bucket
S3_PUBLIC_DOMAIN=https://s3-for-LobeHub.your-domain.com
```
<Callout type={'warning'}>
@@ -202,6 +204,9 @@ In the server-side database, we need to configure the S3 storage service to stor
S3_BUCKET=LobeHub
# Bucket request endpoint
S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
# Public domain for bucket access
S3_PUBLIC_DOMAIN=https://s3-dev.your-domain.com
# Bucket region, such as us-west-1, generally not required, but some providers may need to configure
# S3_REGION=us-west-1
```
@@ -283,6 +288,8 @@ S3_SECRET_ACCESS_KEY=55af75d8eb6b99f189f6a35f855336ea62cd9c4751a5cf4337c53c1d3f4
S3_BUCKET=LobeHub
# Bucket request endpoint
S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
# Public access domain for the bucket
S3_PUBLIC_DOMAIN=https://s3-for-LobeHub.your-domain.com
# Bucket region, such as us-west-1, generally not needed to add, but some service providers may require configuration
# S3_REGION=us-west-1
```
@@ -153,6 +153,8 @@ tags:
S3_BUCKET=LobeHub
# 存储桶的请求端点(注意此处链接的路径带存储桶名称,必须删除该路径,或使用申请 S3 API token 页面所提供的链接)
S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
# 存储桶对外的访问域名
S3_PUBLIC_DOMAIN=https://s3-for-LobeHub.your-domain.com
```
<Callout type={'warning'}>`S3_ENDPOINT`必须删除其路径,否则会无法访问所上传文件</Callout>
@@ -197,6 +199,9 @@ tags:
S3_BUCKET=LobeHub
# 存储桶的请求端点
S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
# 存储桶对外的访问域名
S3_PUBLIC_DOMAIN=https://s3-dev.your-domain.com
# 桶的区域,如 us-west-1,一般来说不需要添加,但某些服务商则需要配置
# S3_REGION=us-west-1
```
@@ -278,6 +283,8 @@ S3_SECRET_ACCESS_KEY=55af75d8eb6b99f189f6a35f855336ea62cd9c4751a5cf4337c53c1d3f4
S3_BUCKET=LobeHub
# 存储桶的请求端点
S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
# 存储桶对外的访问域名
S3_PUBLIC_DOMAIN=https://s3-for-LobeHub.your-domain.com
# 桶的区域,如 us-west-1,一般来说不需要添加,但某些服务商则需要配置
# S3_REGION=us-west-1
```