Page MenuHomePhabricator

Can't set https as elasticsearch server
Closed, ResolvedPublic

Description

I have elasticsearch server listening to https (443).
When I'm set configuration like this:

$wgCirrusSearchClusters = $wgCirrusSearchWriteClusters = array(  
        "default"=>[[
                "host" => "https://HOSTNAME",
                "port" => 443
        ]]
);

Cirrus is trying to curl to http://https://HOSTNAME:443.
If I ommit the https prefix, like this

$wgCirrusSearchClusters = $wgCirrusSearchWriteClusters = array(  
        "default"=>[[
                "host" => "HOSTNAME",
                "port" => 443
        ]]
);

Cirrus is curling to http://HOSTNAME:443.

Very wild guess: this relate to code on
Elastica/vendor/ruflin/elastica/lib/Elastica/Transport/Http.php (line 56)

if (!empty($url)) {
    $baseUri = $url;
} else {
    $baseUri = $this->_scheme.'://'.$connection->getHost().':'.$connection->getPort().'/'.$connection->getPath();
}

Because $this->_scheme is fixed ad http (see line 24), the php try curl this strange url.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Reedy subscribed.

Very wild guess: this relate to code on Elastica/vendor/ruflin/elastica/lib/Elastica/Transport/Http.php (line 56)

If this is the case, you need to see if it's still an issue Upstream at https://github.com/ruflin/Elastica, and if it is, report the issue there for a fix first...

Though, looking at their code in the 6.x branch, they do have already have a Https transport, https://github.com/ruflin/Elastica/blob/6.x/lib/Elastica/Transport/Https.php

That being said, as the code/config is written, I wouldn't expect a "host" parameter to take a protocol (ie https://, as i'd think that would be something more like url), and the examples don't show the usage of http (and putting http in the host would break in the same was as https)

But looking at the AbstractTransport class, it does take a type (such as 'http')...

So I guess a type/protocol/similar parameter really needs adding to the config variables, so it eventually gets passed through to AbstractTransport

I guess this is more a feature request, than actually a bug, as AFAIS it was never supported

EBernhardson moved this task from needs triage to elastic / cirrus on the Discovery-Search board.
Gehel claimed this task.
Gehel subscribed.

Since the link to ProductionServices isn't all that stable, here is a configuration example:

	'cloudelastic-psi' => [
		[
			'host' => 'cloudelastic.wikimedia.org',
			'transport' => 'Https',
			'port' => 9443,
		],
	],

Since this should be sufficient to fix the initial issue, I'm closing this ticket.