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
98 stars 45 forks source link

fix: Separate http and https agents definitions #2310

Closed taratatach closed 1 year ago

taratatach commented 1 year ago

We still had issues with the new proxy setup event after we changed our proxy agent implementation to use our own ProxyAgent. As it turns out, it's because http and https modules would share the same agent and when trying to make requests, the wrong protocol might be used.

We now create 2 separate ProxyAgent instances and define the protocol to use for each one so requests will always be sent with the right one, even when computed in unexpected manners like when wrapped by Sentry.

This however means that we need to provide the appropriate agent when requests would not be made using the default http or https agent. This is the case for WebSockets for example.

Please make sure the following boxes are checked: