Skip to content

[Bug]: Matrix channel fails behind HTTP proxy although Matrix /sync works via Node + proxy #42234

@henrijd

Description

@henrijd

Bug type

Behavior bug (incorrect output/state without crash)

Summary

The OpenClaw Matrix channel fails to connect to a Matrix homeserver when running behind a corporate HTTP proxy, even though:

the same machine can connect using Element

direct Node.js tests using HttpsProxyAgent succeed

repeated /sync requests through the same proxy work reliably

This suggests that the Matrix integration (or its use of matrix-bot-sdk) does not consistently route requests through the configured proxy.

Steps to reproduce

Matrix configuration (OpenClaw)
-> Using access token authentication:

Expected behavior

OpenClaw should connect to the Matrix homeserver and begin /sync normally through the configured proxy.

Actual behavior

MatrixHttpClient Error: socket hang up
code: ECONNRESET

OpenClaw version

2026.3.8

Operating system

Windows 11

Install method

npm

Model

OpenAI/ChatGPT 5.4

Provider / routing chain

openclaw -> local proxy (px) -> corporate proxy -> cloudflare proxy -> home reverse proxy (zoraxy) -> matrix synapse server

Config file / key location

No response

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Image

Impact and severity

No response

Additional information

##Important diagnostic result

Running the same Matrix /sync request via Node + proxy works perfectly.

Test code:

node -e "
const https=require('node:https');
const { HttpsProxyAgent } = require('https-proxy-agent');

const token=process.env.MATRIX_TOKEN;
const agent=new HttpsProxyAgent('http://127.0.0.1:3128');

let i=0;

function run(){
 i++;
 console.log('sync',i);

 https.get(
   'https://matrix.henrijd.com/_matrix/client/v3/sync?timeout=30000',
   {agent,headers:{Authorization:'Bearer '+token}},
   res=>{
     console.log('status',res.statusCode);
     let n=0;
     res.on('data',c=>n+=c.length);
     res.on('end',()=>{
       console.log('done bytes',n);
       if(i<5) setTimeout(run,1000);
       else console.log('all done');
     });
   }
 ).on('error',e=>console.error('ERR',e.code,e.message));
}

run();
"

Result:

sync 1
status 200
done bytes 4753
sync 2
status 200
done bytes 4755
sync 3
status 200
done bytes 4755
sync 4
status 200
done bytes 4755
sync 5
status 200
done bytes 4755
all done

This confirms:

  • the proxy works
  • /sync long polling works
  • the Matrix server is reachable

Conclusion

Since:

  • Element works
  • direct Node proxy tests work
  • repeated /sync requests work
  • OpenClaw fails under the same network conditions

this strongly suggests the issue lies in how the OpenClaw Matrix integration or its matrix-bot-sdk transport handles proxies.

Possibly:

  • not all HTTP requests are routed through the configured request function
  • some requests bypass the proxy
  • inconsistent proxy handling during /sync

Additional notes

During debugging we also attempted:

  • overriding matrix-bot-sdk request function
  • using request, request-promise-native
  • using proxy environment variables

These changes did not resolve the issue.

Request

Could you confirm:

  • whether the Matrix channel fully supports HTTP proxies
  • whether matrix-bot-sdk requests are guaranteed to use the configured transport
  • if there is a recommended way to run the Matrix channel behind a corporate proxy

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingbug:behaviorIncorrect behavior without a crash

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions