openclaw - 💡(How to fix) Fix [BUG] mitmproxy causes gateway LLM timeouts [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#51391Fetched 2026-04-08 01:11:50
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Participants
Timeline (top)
labeled ×2closed ×1commented ×1locked ×1

Code Example

cd /Users/thoffman/openclaw && pnpm build && \
   HTTPS_PROXY=http://127.0.0.1:8080 HTTP_PROXY=http://127.0.0.1:8080 \
   NO_PROXY=127.0.0.1,localhost \
   NODE_EXTRA_CA_CERTS=/Users/thoffman/.mitmproxy/mitmproxy-ca-cert.pem \
   pnpm openclaw --dev gateway --verbose
RAW_BUFFERClick to expand / collapse

name: Bug report: mitmproxy causes gateway LLM timeouts about: When running OpenClaw gateway behind mitmproxy, LLM requests timeout title: '[BUG] mitmproxy causes gateway LLM timeouts' labels: bug

Bug Description

When starting the OpenClaw gateway with mitmproxy as the HTTP/HTTPS proxy, LLM requests timeout. The UI shows "LLM timeout" errors.

Steps to Reproduce

  1. Start mitmproxy on 127.0.0.1:8080
  2. Run gateway with proxy env vars:
    cd /Users/thoffman/openclaw && pnpm build && \
    HTTPS_PROXY=http://127.0.0.1:8080 HTTP_PROXY=http://127.0.0.1:8080 \
    NO_PROXY=127.0.0.1,localhost \
    NODE_EXTRA_CA_CERTS=/Users/thoffman/.mitmproxy/mitmproxy-ca-cert.pem \
    pnpm openclaw --dev gateway --verbose
  3. Attempt to use any LLM through the gateway
  4. UI shows "LLM timeout"

Expected Behavior

LLM requests should work through the mitmproxy, or the gateway should handle/expose the proxy configuration more gracefully.

Environment

  • macOS (Darwin 25.2.0 arm64)
  • mitmproxy
  • OpenClaw gateway in dev mode

Additional Context

  • Without the proxy env vars, the gateway works fine
  • NODE_EXTRA_CA_CERTS is set to mitmproxy's CA cert
  • The timeout happens consistently on all LLM requests

extent analysis

Fix Plan

The fix involves configuring mitmproxy to increase the timeout for LLM requests and ensuring the OpenClaw gateway properly handles the proxy settings.

Steps to Fix

  • Increase the timeout in mitmproxy by adding the following option when starting mitmproxy:
    --set timeout=300  # sets the timeout to 5 minutes
  • Update the OpenClaw gateway to handle proxy settings more robustly. This can be achieved by adding a retry mechanism for LLM requests. Example code snippet:
    const axios = require('axios');
    
    // Set up axios with retry mechanism
    const axiosClient = axios.create({
      // Existing config...
      timeout: 300000, // 5 minutes
      retry: 3, // number of retries
      retryDelay: 1000 // delay between retries in milliseconds
    });
    
    // Use axiosClient for LLM requests
    axiosClient.get(llmUrl)
      .then(response => {
        // Handle response
      })
      .catch(error => {
        // Handle error
      });
  • Ensure the NODE_EXTRA_CA_CERTS environment variable is correctly set to the path of the mitmproxy CA certificate.

Verification

To verify the fix, restart mitmproxy with the increased timeout and run the OpenClaw gateway with the updated proxy settings. Attempt to use an LLM through the gateway and check if the "LLM timeout" error is resolved.

Extra Tips

  • Regularly review and update the mitmproxy configuration to ensure it aligns with the requirements of the OpenClaw gateway and LLM requests.
  • Consider implementing a more robust error handling mechanism in the OpenClaw gateway to handle potential issues with the 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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING