directus/directus

Support proxies for file storage adapters

Open

#24,381 建立於 2025年1月10日

在 GitHub 查看
 (1 留言) (0 反應) (0 負責人)TypeScript (25,193 star) (3,505 fork)batch import
EngineHelp WantedImprovement

描述

Describe the Bug

While trying to upload a file to s3 on a machine where there is an environment variable for proxy, this is ignored by the httpAgent and httpsAgent, so the upload is always blocked, to solve this we swapped both agent for ProxyAgent, everything works the same but proxy variables are retrived and used correctly

+import { ProxyAgent } from "proxy-agent";
 var DriverS3 = class {
   config;
   client;
@@ -54,8 +53,8 @@ var DriverS3 = class {
       requestHandler: new NodeHttpHandler({
         connectionTimeout,
         socketTimeout,
-        httpAgent: new HttpAgent({ maxSockets, keepAlive }),
-        httpsAgent: new HttpsAgent({ maxSockets, keepAlive })
+        httpAgent: new ProxyAgent({ maxSockets, keepAlive }),
+        httpsAgent: new ProxyAgent({ maxSockets, keepAlive })
       })

To Reproduce

Try to upload a file to s3 through a machine that needs a proxy to make requests to external services

Directus Version

11.3.5

Hosting Strategy

Self-Hosted (Docker Image)

Database

No response

貢獻者指南