From 72b918cddf846f4f3fd8e3f2d371e795a5542ade Mon Sep 17 00:00:00 2001 From: W1ndys Date: Sun, 20 Sep 2026 17:38:44 +0000 Subject: [PATCH 1/2] docs: explain HTTP proxy address when AstrBot runs in Docker --- docs/en/deploy/astrbot/docker.md | 13 +++++++++++++ docs/en/dev/astrbot-config.md | 2 +- docs/en/use/webui.md | 2 +- docs/zh/deploy/astrbot/docker.md | 13 +++++++++++++ docs/zh/dev/astrbot-config.md | 2 +- docs/zh/use/webui.md | 2 +- 6 files changed, 30 insertions(+), 4 deletions(-) diff --git a/docs/en/deploy/astrbot/docker.md b/docs/en/deploy/astrbot/docker.md index 5b3d6a117c..3bb99f4477 100644 --- a/docs/en/deploy/astrbot/docker.md +++ b/docs/en/deploy/astrbot/docker.md @@ -124,3 +124,16 @@ If there are no errors, you will see a log message similar to `🌈 Dashboard st > If deployed on a cloud server, you need to open ports `6180-6200` and `11451` in the cloud provider's console. Next, you need to deploy any messaging platform to use AstrBot on that platform. + +## Configure an HTTP proxy in Docker + +Set the HTTP proxy in the WebUI under `Settings → Network → Proxy & Dependency Sources → HTTP Proxy`. AstrBot reaches that address **from inside its own container**, so `http://127.0.0.1:7890` points at the AstrBot container itself rather than the host or another container. + +If the proxy runs on the host, or in another container with the port published to the host: + +- Mac / Windows (Docker Desktop): `http://host.docker.internal:7890` +- Linux: `http://172.17.0.1:7890` (replace `172.17.0.1` with your docker0 gateway if it differs) + +If AstrBot and the proxy share a Docker network, use the proxy container name, for example `http://clash:7890`. + +Clash-style clients commonly use HTTP on `7890` and SOCKS on `7891`. Use `http://` or `socks5://` to match the protocol. Publish the proxy port to the host, and avoid binding it only to `127.0.0.1` (`127.0.0.1:7890:7890` is unreachable from other containers via the gateway). diff --git a/docs/en/dev/astrbot-config.md b/docs/en/dev/astrbot-config.md index 712a83968f..bb42ec2f60 100644 --- a/docs/en/dev/astrbot-config.md +++ b/docs/en/dev/astrbot-config.md @@ -489,7 +489,7 @@ Whether to enable the file service. Default is `false`. When enabled, the bot pr ### `http_proxy` -HTTP proxy. E.g., `http://localhost:7890`. +HTTP proxy. E.g., `http://localhost:7890`. When AstrBot runs in Docker, use an address reachable from the AstrBot container. See [Deploy with Docker](/en/deploy/astrbot/docker.md). ### `no_proxy` diff --git a/docs/en/use/webui.md b/docs/en/use/webui.md index 837e43b903..49b16373dc 100644 --- a/docs/en/use/webui.md +++ b/docs/en/use/webui.md @@ -92,7 +92,7 @@ Global settings are under `Settings` at the bottom of the sidebar: - `General`: timezone, external callback address, logs, and cache. - `Appearance`: sidebar, theme, and text-to-image rendering. -- `Network`: HTTP proxy, Python package sources, and GitHub proxy. +- `Network`: HTTP proxy, Python package sources, and GitHub proxy. For the address to use when AstrBot runs in Docker, see [Deploy with Docker](/en/deploy/astrbot/docker.md). - `Security`: WebUI HTTPS, login rate limits, and TOTP. - `Maintenance`: backup, restore, and restart. - `OpenAPI`: developer access keys. diff --git a/docs/zh/deploy/astrbot/docker.md b/docs/zh/deploy/astrbot/docker.md index daf616aa0a..daf081f8c7 100644 --- a/docs/zh/deploy/astrbot/docker.md +++ b/docs/zh/deploy/astrbot/docker.md @@ -140,3 +140,16 @@ docker run -itd -p 6185:6185 -p 6199:6199 -e TZ=Asia/Shanghai -v "${PWD}\data:/A > 如果部署在云服务器上,需要在相应厂商控制台里放行对应端口。 接下来,你需要部署任何一个消息平台,才能够实现在消息平台上使用 AstrBot。 + +## 在 Docker 中配置 HTTP 代理 + +AstrBot 的 HTTP 代理在 WebUI:`设置 → 网络 → 代理与依赖源 → HTTP 代理`。填写的地址由 **AstrBot 容器内部**访问,因此 `http://127.0.0.1:7890` 会连到 AstrBot 容器自己,而不是宿主机或其他容器。 + +代理跑在宿主机、或另一个容器并把端口映射到宿主机时: + +- Mac / Windows(Docker Desktop):`http://host.docker.internal:7890` +- Linux:`http://172.17.0.1:7890`(把 `172.17.0.1` 换成本机 docker0 网关) + +AstrBot 与代理在同一 Docker 网络时,用容器名,例如 `http://clash:7890`。 + +Clash 一类软件常见 HTTP `7890`、SOCKS `7891`,按实际协议写 `http://` 或 `socks5://`。请确认代理端口已映射到宿主机,且不是只绑在 `127.0.0.1`(写成 `127.0.0.1:7890:7890` 时,其他容器从网关进不去)。 diff --git a/docs/zh/dev/astrbot-config.md b/docs/zh/dev/astrbot-config.md index 7e6e242b26..c7b6c46522 100644 --- a/docs/zh/dev/astrbot-config.md +++ b/docs/zh/dev/astrbot-config.md @@ -489,7 +489,7 @@ AstrBot API 的地址。用于渲染 Markdown 图片。当 `t2i_strategy` 为 `r ### `http_proxy` -HTTP 代理。如 `http://localhost:7890`。 +HTTP 代理。如 `http://localhost:7890`。Docker 部署时请填写 AstrBot 容器能访问到的地址,见 [Docker 部署](/deploy/astrbot/docker.md)。 ### `no_proxy` diff --git a/docs/zh/use/webui.md b/docs/zh/use/webui.md index b5d38e1242..c31c8c4a30 100644 --- a/docs/zh/use/webui.md +++ b/docs/zh/use/webui.md @@ -92,7 +92,7 @@ ChatUI 支持以下常用能力: - `常规`:时区、外部回调地址、日志和缓存。 - `外观`:侧边栏、主题和文本转图像。 -- `网络`:HTTP 代理、Python 依赖源和 GitHub 加速地址。 +- `网络`:HTTP 代理、Python 依赖源和 GitHub 加速地址。Docker 下的代理填法见 [Docker 部署](/deploy/astrbot/docker.md)。 - `安全`:WebUI HTTPS、登录限速和 TOTP。 - `维护`:备份、恢复和重启。 - `OpenAPI`:开发者访问密钥。 From 644a84cc1432de4ff04b7a510671a86a70e74fa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=B7=E5=8D=B7?= Date: Mon, 21 Sep 2026 10:45:58 +0800 Subject: [PATCH 2/2] Apply suggestion from @sourcery-ai[bot] Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> --- docs/en/deploy/astrbot/docker.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/deploy/astrbot/docker.md b/docs/en/deploy/astrbot/docker.md index 3bb99f4477..7fae3e1dba 100644 --- a/docs/en/deploy/astrbot/docker.md +++ b/docs/en/deploy/astrbot/docker.md @@ -136,4 +136,4 @@ If the proxy runs on the host, or in another container with the port published t If AstrBot and the proxy share a Docker network, use the proxy container name, for example `http://clash:7890`. -Clash-style clients commonly use HTTP on `7890` and SOCKS on `7891`. Use `http://` or `socks5://` to match the protocol. Publish the proxy port to the host, and avoid binding it only to `127.0.0.1` (`127.0.0.1:7890:7890` is unreachable from other containers via the gateway). +Clash-style clients commonly use HTTP on `7890` and SOCKS on `7891`. Use `http://` or `socks5://` to match the protocol. For a host-installed proxy, it must listen on a host interface reachable from Docker, such as `0.0.0.0` or the Docker gateway interface, rather than only `127.0.0.1`; publish the proxy port to the host.