openclaw - 💡(How to fix) Fix Top-level network proxy breaks Discord TLS when using local HTTP proxy [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#74809Fetched 2026-05-01 05:41:08
View on GitHub
Comments
1
Participants
2
Timeline
10
Reactions
2
Timeline (top)
mentioned ×4subscribed ×4commented ×1cross-referenced ×1

Enabling the documented top-level network proxy with a local HTTP forward proxy caused Discord gateway TLS failures. The same local proxy works with raw curl and Undici ProxyAgent, so the failure appears specific to OpenClaw's process-wide global-agent routing path.

Error Message

After restarting the gateway, OpenClaw logs proxy activation:

Root Cause

Enabling the documented top-level network proxy with a local HTTP forward proxy caused Discord gateway TLS failures. The same local proxy works with raw curl and Undici ProxyAgent, so the failure appears specific to OpenClaw's process-wide global-agent routing path.

Fix Action

Fix / Workaround

const { ProxyAgent, fetch } = require('undici');
const agent = new ProxyAgent('http://127.0.0.1:6152');
const res = await fetch('https://discord.gg', { dispatcher: agent });
console.log(res.status); // 200/301-class success depending redirect handling

Workaround used locally

Do not use top-level proxy for this fleet. Instead, configure owner/provider-specific explicit proxies:

Code Example

"proxy": {
  "enabled": true,
  "proxyUrl": "http://127.0.0.1:6152"
}

---

[proxy] routing process HTTP traffic through external proxy http://127.0.0.1:6152

---

[discord] gateway error: Error: Hostname/IP does not match certificate's altnames: Host: localhost. is not in the cert's altnames: DNS:discord.gg, DNS:*.discord.gg
[discord] gateway was not ready after 15000ms; restarting gateway

---

curl --proxy http://127.0.0.1:6152 https://discord.gg
# returns HTTP/2 301 to https://discord.com

---

const { ProxyAgent, fetch } = require('undici');
const agent = new ProxyAgent('http://127.0.0.1:6152');
const res = await fetch('https://discord.gg', { dispatcher: agent });
console.log(res.status); // 200/301-class success depending redirect handling

---

process.env.GLOBAL_AGENT_HTTP_PROXY = 'http://127.0.0.1:6152';
process.env.GLOBAL_AGENT_HTTPS_PROXY = 'http://127.0.0.1:6152';
process.env.GLOBAL_AGENT_FORCE_GLOBAL_AGENT = 'true';
process.env.GLOBAL_AGENT_NO_PROXY = '';
require('global-agent').bootstrap();

require('node:https').get('https://discord.gg').on('error', console.error);
// Hostname/IP does not match certificate's altnames: Host: localhost...

---

"channels": {
  "discord": {
    "accounts": {
      "<id>": { "proxy": "http://127.0.0.1:6152" }
    }
  },
  "telegram": {
    "accounts": {
      "default": { "proxy": "http://127.0.0.1:6152" }
    }
  }
}

---

"request": {
  "proxy": {
    "mode": "explicit-proxy",
    "url": "http://127.0.0.1:6152"
  }
}
RAW_BUFFERClick to expand / collapse

Bug type

Network proxy / transport bug

Version

OpenClaw 2026.4.27 (cbc2ba0)

Summary

Enabling the documented top-level network proxy with a local HTTP forward proxy caused Discord gateway TLS failures. The same local proxy works with raw curl and Undici ProxyAgent, so the failure appears specific to OpenClaw's process-wide global-agent routing path.

Environment

  • macOS host
  • Surge local HTTP proxy listening at http://127.0.0.1:6152
  • Gateway bound to loopback

Config that triggers it

"proxy": {
  "enabled": true,
  "proxyUrl": "http://127.0.0.1:6152"
}

Observed behavior

After restarting the gateway, OpenClaw logs proxy activation:

[proxy] routing process HTTP traffic through external proxy http://127.0.0.1:6152

Then Discord channel startup enters gateway reconnect/restart loops with TLS errors:

[discord] gateway error: Error: Hostname/IP does not match certificate's altnames: Host: localhost. is not in the cert's altnames: DNS:discord.gg, DNS:*.discord.gg
[discord] gateway was not ready after 15000ms; restarting gateway

Telegram command/webhook calls also failed while this top-level proxy was active, though the Discord TLS error is the clearest symptom.

Expected behavior

Top-level proxy.enabled=true should route Discord gateway/API traffic through the configured HTTP forward proxy without changing TLS server name verification to the proxy hostname.

Evidence that the proxy itself is not the problem

Raw Surge proxy to Discord works:

curl --proxy http://127.0.0.1:6152 https://discord.gg
# returns HTTP/2 301 to https://discord.com

Undici explicit proxy also works:

const { ProxyAgent, fetch } = require('undici');
const agent = new ProxyAgent('http://127.0.0.1:6152');
const res = await fetch('https://discord.gg', { dispatcher: agent });
console.log(res.status); // 200/301-class success depending redirect handling

But reproducing the OpenClaw-style global-agent hook fails with the same TLS error:

process.env.GLOBAL_AGENT_HTTP_PROXY = 'http://127.0.0.1:6152';
process.env.GLOBAL_AGENT_HTTPS_PROXY = 'http://127.0.0.1:6152';
process.env.GLOBAL_AGENT_FORCE_GLOBAL_AGENT = 'true';
process.env.GLOBAL_AGENT_NO_PROXY = '';
require('global-agent').bootstrap();

require('node:https').get('https://discord.gg').on('error', console.error);
// Hostname/IP does not match certificate's altnames: Host: localhost...

Workaround used locally

Do not use top-level proxy for this fleet. Instead, configure owner/provider-specific explicit proxies:

"channels": {
  "discord": {
    "accounts": {
      "<id>": { "proxy": "http://127.0.0.1:6152" }
    }
  },
  "telegram": {
    "accounts": {
      "default": { "proxy": "http://127.0.0.1:6152" }
    }
  }
}

And provider-level explicit proxy config:

"request": {
  "proxy": {
    "mode": "explicit-proxy",
    "url": "http://127.0.0.1:6152"
  }
}

This path logs discord rest proxy enabled and discord gateway proxy enabled and avoids the Host: localhost TLS failure.

Notes

The documented network proxy feature says it covers fetch, node:http, node:https, and WebSocket clients through Undici plus global-agent. Based on this repro, the global-agent part appears unsafe with at least this common local HTTP proxy setup.

extent analysis

TL;DR

Disable the top-level network proxy and configure explicit proxies for each channel or provider to avoid TLS errors with the global-agent routing path.

Guidance

  • The issue seems to be related to the global-agent library and its interaction with the local HTTP proxy, causing TLS errors due to hostname mismatch.
  • To verify, try disabling the top-level proxy and configuring explicit proxies for each channel or provider, as shown in the workaround used locally.
  • The global-agent library appears to be routing traffic through the proxy, but not preserving the original hostname, leading to TLS errors.
  • Configuring explicit proxies for each channel or provider allows for more fine-grained control over proxy settings and avoids the global-agent issue.

Example

No code snippet is provided as the issue is more related to configuration and library interaction.

Notes

The global-agent library is not compatible with the local HTTP proxy setup, and using explicit proxies for each channel or provider is a safer approach.

Recommendation

Apply workaround: Configure explicit proxies for each channel or provider, as this approach avoids the global-agent issue and allows for more fine-grained control over proxy settings.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Top-level proxy.enabled=true should route Discord gateway/API traffic through the configured HTTP forward proxy without changing TLS server name verification to the proxy hostname.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Top-level network proxy breaks Discord TLS when using local HTTP proxy [1 comments, 2 participants]