From c3ba720d0b8cc0a57b00011d298afedd54f168fe Mon Sep 17 00:00:00 2001 From: macm1 Date: Sun, 22 Feb 2026 19:51:17 +0300 Subject: [PATCH 1/4] added proxy support --- openclaw_assistant/CHANGELOG.md | 1 + openclaw_assistant/Dockerfile | 3 ++- openclaw_assistant/openclaw-proxy-shim.cjs | 29 ++++++++++++++++++++++ openclaw_assistant/run.sh | 14 +++++++++++ 4 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 openclaw_assistant/openclaw-proxy-shim.cjs diff --git a/openclaw_assistant/CHANGELOG.md b/openclaw_assistant/CHANGELOG.md index f83f53e..0f6693c 100644 --- a/openclaw_assistant/CHANGELOG.md +++ b/openclaw_assistant/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to the OpenClaw Assistant Home Assistant Add-on will be docu ### Changed - Bump OpenClaw to 2026.2.21-2. - Add Home Assistant `share` and `media` mounts to the add-on (`map: share:rw, media:rw`). +- Keep official OpenClaw npm release and add startup proxy shim for `HTTP_PROXY/HTTPS_PROXY` support in undici fetch. ## [0.5.47] - 2026-02-21 diff --git a/openclaw_assistant/Dockerfile b/openclaw_assistant/Dockerfile index 94b8382..74ee807 100644 --- a/openclaw_assistant/Dockerfile +++ b/openclaw_assistant/Dockerfile @@ -100,7 +100,7 @@ RUN if [ -x /home/linuxbrew/.linuxbrew/bin/brew ]; then \ fi USER root -# Install OpenClaw globally +# Install OpenClaw globally (official npm release) RUN npm config set fund false && npm config set audit false \ && npm install -g openclaw@2026.2.21-2 @@ -124,6 +124,7 @@ fi EOF COPY run.sh /run.sh COPY oc_config_helper.py /oc_config_helper.py +COPY openclaw-proxy-shim.cjs /usr/local/lib/openclaw-proxy-shim.cjs COPY nginx.conf.tpl /etc/nginx/nginx.conf.tpl COPY landing.html.tpl /etc/nginx/landing.html.tpl RUN chmod +x /run.sh /oc_config_helper.py \ diff --git a/openclaw_assistant/openclaw-proxy-shim.cjs b/openclaw_assistant/openclaw-proxy-shim.cjs new file mode 100644 index 0000000..ee5d463 --- /dev/null +++ b/openclaw_assistant/openclaw-proxy-shim.cjs @@ -0,0 +1,29 @@ +"use strict"; + +/** + * Enable HTTP(S) proxy support for Node/undici before OpenClaw initializes. + * We load undici from OpenClaw's own node_modules path to avoid relying on + * global module resolution from this shim's location. + */ +(function applyProxyFromEnv() { + const hasProxyEnv = + !!process.env.HTTPS_PROXY || + !!process.env.HTTP_PROXY || + !!process.env.https_proxy || + !!process.env.http_proxy; + + if (!hasProxyEnv) { + return; + } + + try { + const path = require("node:path"); + const globalModulesRoot = + process.env.OPENCLAW_GLOBAL_NODE_MODULES || "/usr/lib/node_modules"; + const undiciPath = path.join(globalModulesRoot, "openclaw", "node_modules", "undici"); + const { EnvHttpProxyAgent, setGlobalDispatcher } = require(undiciPath); + setGlobalDispatcher(new EnvHttpProxyAgent()); + } catch (_err) { + // Keep startup resilient if module layout changes in future releases. + } +})(); diff --git a/openclaw_assistant/run.sh b/openclaw_assistant/run.sh index 3f259a9..c017d65 100644 --- a/openclaw_assistant/run.sh +++ b/openclaw_assistant/run.sh @@ -347,6 +347,20 @@ else echo "INFO: Run 'openclaw onboard' first, then restart the add-on" fi +# ------------------------------------------------------------------------------ +# Proxy shim for undici/OpenClaw startup +# Keep official OpenClaw npm release while enabling HTTP(S)_PROXY support. +# ------------------------------------------------------------------------------ +OPENCLAW_GLOBAL_NODE_MODULES="$(HOME=/root npm root -g 2>/dev/null || true)" +if [ -f /usr/local/lib/openclaw-proxy-shim.cjs ]; then + if [ -n "${NODE_OPTIONS:-}" ]; then + export NODE_OPTIONS="--require /usr/local/lib/openclaw-proxy-shim.cjs ${NODE_OPTIONS}" + else + export NODE_OPTIONS="--require /usr/local/lib/openclaw-proxy-shim.cjs" + fi + export OPENCLAW_GLOBAL_NODE_MODULES +fi + echo "Starting OpenClaw Assistant gateway (openclaw)..." openclaw gateway run & GW_PID=$! From ab33e6702f3568cc5d5c308d2698478edd404e1f Mon Sep 17 00:00:00 2001 From: macm1 Date: Sun, 22 Feb 2026 19:54:51 +0300 Subject: [PATCH 2/4] added proxy configuration to haos addon config ui --- openclaw_assistant/config.yaml | 6 +++++- openclaw_assistant/run.sh | 15 +++++++++++++++ openclaw_assistant/translations/bg.yaml | 4 ++++ openclaw_assistant/translations/de.yaml | 4 ++++ openclaw_assistant/translations/en.yaml | 4 ++++ openclaw_assistant/translations/es.yaml | 4 ++++ openclaw_assistant/translations/pl.yaml | 4 ++++ openclaw_assistant/translations/pt-BR.yaml | 4 ++++ 8 files changed, 44 insertions(+), 1 deletion(-) diff --git a/openclaw_assistant/config.yaml b/openclaw_assistant/config.yaml index 1980103..3a04bf9 100644 --- a/openclaw_assistant/config.yaml +++ b/openclaw_assistant/config.yaml @@ -41,6 +41,10 @@ options: # Optional: Home Assistant long-lived token (for local HA API scripts/tools) homeassistant_token: "" + # Optional: outbound HTTP/HTTPS proxy for OpenClaw network access. + # Example: "http://192.168.2.1:3128" + http_proxy: "" + # Optional: Router SSH defaults (leave empty if you don't need router automation) # This is a generic SSH configuration intended for a router/firewall or any network device # reachable from inside the HA host LAN. @@ -91,6 +95,7 @@ schema: terminal_port: int(1024,65535)? gateway_public_url: str? homeassistant_token: str? + http_proxy: str? router_ssh_host: str router_ssh_user: str @@ -104,4 +109,3 @@ schema: enable_openai_api: bool? allow_insecure_auth: bool? force_ipv4_dns: bool? - diff --git a/openclaw_assistant/run.sh b/openclaw_assistant/run.sh index c017d65..d425437 100644 --- a/openclaw_assistant/run.sh +++ b/openclaw_assistant/run.sh @@ -20,6 +20,7 @@ fi TZNAME=$(jq -r '.timezone // "Europe/Sofia"' "$OPTIONS_FILE") GW_PUBLIC_URL=$(jq -r '.gateway_public_url // empty' "$OPTIONS_FILE") HA_TOKEN=$(jq -r '.homeassistant_token // empty' "$OPTIONS_FILE") +ADDON_HTTP_PROXY=$(jq -r '.http_proxy // empty' "$OPTIONS_FILE") ENABLE_TERMINAL=$(jq -r '.enable_terminal // true' "$OPTIONS_FILE") TERMINAL_PORT_RAW=$(jq -r '.terminal_port // 7681' "$OPTIONS_FILE") @@ -57,6 +58,20 @@ export TZ="$TZNAME" # Reduce risk of secrets ending up in logs set +x +# Optional outbound proxy from add-on settings. +# If set, apply it to both HTTP and HTTPS for Node/undici/OpenClaw tooling. +if [ -n "$ADDON_HTTP_PROXY" ]; then + if [[ "$ADDON_HTTP_PROXY" =~ ^https?://[^[:space:]]+$ ]]; then + export HTTP_PROXY="$ADDON_HTTP_PROXY" + export HTTPS_PROXY="$ADDON_HTTP_PROXY" + export http_proxy="$ADDON_HTTP_PROXY" + export https_proxy="$ADDON_HTTP_PROXY" + echo "INFO: Outbound HTTP/HTTPS proxy enabled from add-on configuration." + else + echo "WARN: Invalid http_proxy value in add-on options; expected URL like http://host:port" + fi +fi + # Optional network hardening/workaround: force IPv4-first DNS ordering for Node.js. # Helps in environments where IPv6 resolves but has no working egress. if [ "$FORCE_IPV4_DNS" = "true" ] || [ "$FORCE_IPV4_DNS" = "1" ]; then diff --git a/openclaw_assistant/translations/bg.yaml b/openclaw_assistant/translations/bg.yaml index 068af2d..e8a6514 100644 --- a/openclaw_assistant/translations/bg.yaml +++ b/openclaw_assistant/translations/bg.yaml @@ -18,6 +18,10 @@ configuration: homeassistant_token: name: Home Assistant токен description: Опционално - дълготраен токен на Home Assistant за локални API скриптове/инструменти + + http_proxy: + name: Изходящ HTTP прокси + description: Опционално - URL на прокси за изходящи HTTP/HTTPS заявки (пример - http://192.168.2.1:3128) router_ssh_host: name: SSH хост на рутер diff --git a/openclaw_assistant/translations/de.yaml b/openclaw_assistant/translations/de.yaml index f63c715..f0945b9 100644 --- a/openclaw_assistant/translations/de.yaml +++ b/openclaw_assistant/translations/de.yaml @@ -18,6 +18,10 @@ configuration: homeassistant_token: name: Home Assistant Token description: Optional - Langlebiger Home Assistant Token für lokale API-Skripte/Tools + + http_proxy: + name: Ausgehender HTTP-Proxy + description: Optional - Proxy-URL für ausgehende HTTP/HTTPS-Anfragen (Beispiel - http://192.168.2.1:3128) router_ssh_host: name: Router SSH-Host diff --git a/openclaw_assistant/translations/en.yaml b/openclaw_assistant/translations/en.yaml index 66b013f..191b024 100644 --- a/openclaw_assistant/translations/en.yaml +++ b/openclaw_assistant/translations/en.yaml @@ -18,6 +18,10 @@ configuration: homeassistant_token: name: Home Assistant Token description: Optional - Home Assistant long-lived token for local HA API scripts/tools + + http_proxy: + name: Outbound HTTP Proxy + description: Optional - Proxy URL for outbound HTTP/HTTPS requests (example - http://192.168.2.1:3128) router_ssh_host: name: Router SSH Host diff --git a/openclaw_assistant/translations/es.yaml b/openclaw_assistant/translations/es.yaml index e274275..8a7ce84 100644 --- a/openclaw_assistant/translations/es.yaml +++ b/openclaw_assistant/translations/es.yaml @@ -18,6 +18,10 @@ configuration: homeassistant_token: name: Token de Home Assistant description: Opcional - Token de larga duración de Home Assistant para scripts/herramientas de API local + + http_proxy: + name: Proxy HTTP de salida + description: Opcional - URL de proxy para solicitudes HTTP/HTTPS salientes (ejemplo - http://192.168.2.1:3128) router_ssh_host: name: Host SSH del router diff --git a/openclaw_assistant/translations/pl.yaml b/openclaw_assistant/translations/pl.yaml index 2d445eb..7b6324d 100644 --- a/openclaw_assistant/translations/pl.yaml +++ b/openclaw_assistant/translations/pl.yaml @@ -18,6 +18,10 @@ configuration: homeassistant_token: name: Token Home Assistant description: Opcjonalnie - długoterminowy token Home Assistant dla lokalnych skryptów/narzędzi API HA + + http_proxy: + name: Wychodzący proxy HTTP + description: Opcjonalnie - URL proxy dla wychodzących żądań HTTP/HTTPS (przykład - http://192.168.2.1:3128) router_ssh_host: name: Host SSH routera diff --git a/openclaw_assistant/translations/pt-BR.yaml b/openclaw_assistant/translations/pt-BR.yaml index 78f0376..d688d7f 100644 --- a/openclaw_assistant/translations/pt-BR.yaml +++ b/openclaw_assistant/translations/pt-BR.yaml @@ -18,6 +18,10 @@ configuration: homeassistant_token: name: Token do Home Assistant description: Opcional - Token de longa duração do Home Assistant para scripts/ferramentas da API local do HA + + http_proxy: + name: Proxy HTTP de saída + description: Opcional - URL de proxy para requisições HTTP/HTTPS de saída (exemplo - http://192.168.2.1:3128) router_ssh_host: name: Host SSH do Roteador From cb71b0facaf8ad5e6f5d6099d50e36a9b4c804bb Mon Sep 17 00:00:00 2001 From: macm1 Date: Sun, 22 Feb 2026 20:00:43 +0300 Subject: [PATCH 3/4] changed docs --- DOCS.md | 11 +++++++++++ README.md | 1 + openclaw_assistant/CHANGELOG.md | 10 ++++++++++ openclaw_assistant/config.yaml | 2 +- 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/DOCS.md b/DOCS.md index 9390cd0..15ddcf4 100644 --- a/DOCS.md +++ b/DOCS.md @@ -217,6 +217,7 @@ All options are set via **Settings → Apps/Add-ons → OpenClaw Assistant → C | Option | Type | Default | Description | |---|---|---|---| | `homeassistant_token` | string | _(empty)_ | Optional HA long-lived access token (use at own risk, can be very unsecure but very powerful). Saved to `/config/secrets/homeassistant.token` for use by scripts/skills | +| `http_proxy` | string | _(empty)_ | Optional outbound proxy URL for HTTP/HTTPS requests from OpenClaw and Node tools. Example: `http://192.168.2.1:3128` | ### Router SSH @@ -606,6 +607,16 @@ If Telegram is configured but polling fails with network fetch errors: 3. Keep `channels.telegram.network.autoSelectFamily: false` (default on Node 22). 4. If still failing, check host/VM IPv6 routing and DNS configuration. +### Outbound proxy not applied + +**Symptom**: External API/network calls still fail in restricted networks even after setting proxy. + +**Checks**: +1. Set add-on option `http_proxy` with full URL format: `http://host:port` (example: `http://192.168.2.1:3128`). +2. Restart the add-on after changing configuration. +3. Check logs for `INFO: Outbound HTTP/HTTPS proxy enabled from add-on configuration.` +4. If you see `WARN: Invalid http_proxy value`, fix the URL format and restart. + ### Skills disappearing after update Built-in skills are synced to persistent storage on each startup. If skills are missing: diff --git a/README.md b/README.md index e7857c6..1058994 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ This repository contains a Home Assistant add-on that runs **OpenClaw** inside * - **Web Terminal** — browser-based terminal embedded in Home Assistant - **Assist Pipeline** — use OpenClaw as a conversation agent via the OpenAI-compatible API - **Browser Automation** — Chromium included for web scraping and automation skills +- **Proxy Support** — optional outbound `http_proxy` setting for HTTP/HTTPS traffic - **Persistent Storage** — skills, config, and workspace survive add-on updates - **Bundled Tools** — git, vim, nano, bat, fd, ripgrep, curl, jq, python3, pnpm, Homebrew diff --git a/openclaw_assistant/CHANGELOG.md b/openclaw_assistant/CHANGELOG.md index 0f6693c..3ffc263 100644 --- a/openclaw_assistant/CHANGELOG.md +++ b/openclaw_assistant/CHANGELOG.md @@ -2,6 +2,16 @@ All notable changes to the OpenClaw Assistant Home Assistant Add-on will be documented in this file. +## [0.5.49] - 2026-02-22 + +### Added +- New add-on option `http_proxy` for configuring outbound HTTP/HTTPS proxy from Home Assistant settings. + +### Changed +- Export `HTTP_PROXY`, `HTTPS_PROXY`, `http_proxy`, and `https_proxy` from add-on config at startup. +- Add translations for the new `http_proxy` option. +- Document proxy configuration in README and DOCS. + ## [0.5.48] - 2026-02-22 ### Changed diff --git a/openclaw_assistant/config.yaml b/openclaw_assistant/config.yaml index 3a04bf9..013b2fc 100644 --- a/openclaw_assistant/config.yaml +++ b/openclaw_assistant/config.yaml @@ -1,5 +1,5 @@ name: OpenClaw Assistant -version: "0.5.48" +version: "0.5.49" slug: openclaw_assistant description: Run OpenClaw Assistant (OpenClaw-compatible) as a Home Assistant add-on. url: https://github.com/techartdev/OpenClawHomeAssistant From d118102c11b279db7ab116f76c00052cda7a3b33 Mon Sep 17 00:00:00 2001 From: macm1 Date: Sun, 22 Feb 2026 21:21:11 +0300 Subject: [PATCH 4/4] Add NO_PROXY defaults for http_proxy and document behavior --- DOCS.md | 4 +++- openclaw_assistant/run.sh | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/DOCS.md b/DOCS.md index 15ddcf4..c3c306b 100644 --- a/DOCS.md +++ b/DOCS.md @@ -217,7 +217,7 @@ All options are set via **Settings → Apps/Add-ons → OpenClaw Assistant → C | Option | Type | Default | Description | |---|---|---|---| | `homeassistant_token` | string | _(empty)_ | Optional HA long-lived access token (use at own risk, can be very unsecure but very powerful). Saved to `/config/secrets/homeassistant.token` for use by scripts/skills | -| `http_proxy` | string | _(empty)_ | Optional outbound proxy URL for HTTP/HTTPS requests from OpenClaw and Node tools. Example: `http://192.168.2.1:3128` | +| `http_proxy` | string | _(empty)_ | Optional outbound proxy URL for HTTP/HTTPS requests from OpenClaw and Node tools. Example: `http://192.168.2.1:3128`. When set, the add-on also applies `NO_PROXY/no_proxy` defaults for localhost and private network ranges. | ### Router SSH @@ -616,6 +616,8 @@ If Telegram is configured but polling fails with network fetch errors: 2. Restart the add-on after changing configuration. 3. Check logs for `INFO: Outbound HTTP/HTTPS proxy enabled from add-on configuration.` 4. If you see `WARN: Invalid http_proxy value`, fix the URL format and restart. +5. Local traffic bypass is applied automatically via `NO_PROXY/no_proxy` defaults: + `localhost,127.0.0.1,::1,192.168.0.0/16,10.0.0.0/8,172.16.0.0/12,.local` ### Skills disappearing after update diff --git a/openclaw_assistant/run.sh b/openclaw_assistant/run.sh index d425437..fa89a64 100644 --- a/openclaw_assistant/run.sh +++ b/openclaw_assistant/run.sh @@ -62,11 +62,17 @@ set +x # If set, apply it to both HTTP and HTTPS for Node/undici/OpenClaw tooling. if [ -n "$ADDON_HTTP_PROXY" ]; then if [[ "$ADDON_HTTP_PROXY" =~ ^https?://[^[:space:]]+$ ]]; then + # Keep local traffic direct to avoid accidental proxying of loopback/LAN services. + DEFAULT_NO_PROXY="localhost,127.0.0.1,::1,192.168.0.0/16,10.0.0.0/8,172.16.0.0/12,.local" + export HTTP_PROXY="$ADDON_HTTP_PROXY" export HTTPS_PROXY="$ADDON_HTTP_PROXY" export http_proxy="$ADDON_HTTP_PROXY" export https_proxy="$ADDON_HTTP_PROXY" + export NO_PROXY="${NO_PROXY:+${NO_PROXY},}${DEFAULT_NO_PROXY}" + export no_proxy="${no_proxy:+${no_proxy},}${DEFAULT_NO_PROXY}" echo "INFO: Outbound HTTP/HTTPS proxy enabled from add-on configuration." + echo "INFO: Applied NO_PROXY defaults for localhost/private network ranges." else echo "WARN: Invalid http_proxy value in add-on options; expected URL like http://host:port" fi