Skip to content

Commit 0468c82

Browse files
fix: detect https scheme from transport param in Connection::getClient()
The ES9 PHP SDK client in getClient() was only checking the 'ssl' param to determine the HTTP scheme. However, ECS environments configure clusters with 'transport: https' (without 'ssl: true'), causing HTTP requests to be sent to HTTPS endpoints (nginx returns 400). Now also checks strtolower(getTransport()) === 'https' so that clusters with transport: https get the correct https:// scheme in the SDK client URL. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 85d3df8 commit 0468c82

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/Connection.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,8 @@ public function getClient(): ElasticsearchClient
293293
}
294294

295295
$hosts = [];
296-
$scheme = $this->hasParam('ssl') && $this->getParam('ssl') ? 'https' : 'http';
296+
$scheme = ($this->hasParam('ssl') && $this->getParam('ssl'))
297+
|| \strtolower((string)$this->getTransport()) === 'https' ? 'https' : 'http';
297298
$host = $this->getHost();
298299
$port = $this->getPort();
299300
$path = $this->getPath();

0 commit comments

Comments
 (0)