← Back to library

Telegram 媒体拉取走系统代理:补齐 HTTPS_PROXY/HTTP_PROXY/ALL_PROXY 回退

问题/场景:企业/WSL 环境只配环境变量代理时,Telegram 媒体下载 fetch failed。前置条件:未显式设置 channels.telegram.proxy,但已设置代理环境变量。实施步骤:实现 resolveProxyUrlFromEnv(优先级 HTTPS→HTTP→ALL,大小写不敏感)→ monitor 路径回退到 env 代理 → 保留显式配置优先。关键命令:HTTPS_PROXY=http://proxy:3128 openclaw start。验证:媒体下载请求改经代理转发。风险:send/probe/audit 等链路可能未完全覆盖(需验证)。来源:PR #20883。

GITHUBDiscovered 2026-02-19Author arosstale
Prerequisites
  • Runtime uses Node.js fetch with proxy env vars set at process level.
  • Telegram account has no explicit per-account proxy override (for fallback test).
Steps
  1. Export proxy env vars before startup (HTTPS_PROXY preferred).
  2. Implement env resolver with precedence: HTTPS_PROXY → HTTP_PROXY → ALL_PROXY (case-insensitive).
  3. In Telegram monitor/media path, use explicit channels.telegram.proxy first; fallback to env resolver only when absent.
  4. Re-run media upload/download scenario and compare with baseline failure logs.
Commands
HTTPS_PROXY=http://corporate-proxy:3128 openclaw start
openclaw gateway status
Verify

MediaFetchError fetch failed disappears and media operations succeed via proxy env setup.

Caveats
  • Explicit channel proxy must remain highest priority to avoid unexpected route changes.
  • send/probe/audit paths may still need same fallback for full consistency(需验证).
Source attribution

This tip is aggregated from community/public sources and preserved with attribution.

Open original source ↗
Visit original post