cozy-labs / cozy-desktop

File Synchronisation for Cozy on Desktop and Laptop
https://cozy-labs.github.io/cozy-desktop/
GNU Affero General Public License v3.0
99 stars 45 forks source link

fix: Replace default http Agent with ProxyAgent #2308

Closed taratatach closed 1 year ago

taratatach commented 1 year ago

When replacing electron-proxy-agent with our custom implementation of a proxy agent, we replaced the globalAgent of both http and https modules but left http.Agent.globalAgent untouched.

Unfortunately, this prevented our WebSockets to connect when the Sentry SDK was setup as its wrapper over http.request would make changes to the protocol being used to make the connection.

It seems that the protocol used was the one of http.Agent.globalAgent so replacing this agent again fixes the issue. This also allows us to stop passing a custom agent to the WebSocket constructor and thus simplify the use of cozy-realtime.

Please make sure the following boxes are checked: