From 2d9663b5af14b5b0a35b7fbd99fd5d91d1213215 Mon Sep 17 00:00:00 2001 From: Ronald Fiering Date: Fri, 24 Jan 2025 08:54:03 +0100 Subject: [PATCH] Adjusted proxy handling for Repman instance: Added explicit proxy configuration via stream context to ensure functionality behind a corporate proxy. Since my Repman instance is running behind a corporate proxy, I couldn't use the native proxy functionality provided by Repman directly, as it didn't work in my setup. However, by explicitly setting the proxy configuration in the stream context of my HTTP requests, the connection works as expected. This approach ensures that the traffic is routed through the proxy without relying on Repman's internal handling. --- src/Service/Downloader/ReactDownloader.php | 23 ++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/Service/Downloader/ReactDownloader.php b/src/Service/Downloader/ReactDownloader.php index 5fc964e7..4c9a64a9 100644 --- a/src/Service/Downloader/ReactDownloader.php +++ b/src/Service/Downloader/ReactDownloader.php @@ -90,13 +90,24 @@ public function run(): void */ private function createContext(array $headers = []) { + $proxy = getenv('HTTP_PROXY') ?: null; + $proxyContext = []; + + if ($proxy) { + $proxyContext = [ + 'proxy' => $proxy, + 'request_fulluri' => true, + ]; + } + return stream_context_create([ - 'http' => [ - 'header' => array_merge([sprintf('User-Agent: %s', $this->userAgent())], $headers), - 'follow_location' => 1, - 'max_redirects' => 20, - ], - ]); + 'http' => array_merge([ + 'header' => array_merge([sprintf('User-Agent: %s', $this->userAgent())], $headers), + 'follow_location' => 1, + 'max_redirects' => 20, + ], $proxyContext), + 'https' => $proxyContext, + ]); } private function userAgent(): string