fulltextsearch icon indicating copy to clipboard operation
fulltextsearch copied to clipboard

fulltextsearch Address of the Servlet needs to pass https, but converts to http

Open ferdiga opened this issue 1 year ago • 0 comments

I am using ...aws.elastic-cloud.com:9243 the server applet is defined as https://******************.eu-central-2.aws.elastic-cloud.com:9243/

So I enter exactly this string for "Address of the Servlet" https://user:password@*****************.eu-central-2.aws.elastic-cloud.com:9243

the log files shows

:"Request: PUT http://user:password@*******************.eu-central-2.aws.elastic-cloud.com:9243/service_index/_doc/files%3A45307323?pipeline=attachment","userAgent":"--","version":"29.0.6.1","data":{"app":"fulltextsearch_elasticsearch","request":"{"[object]

which returns an error {"reqId":"Ww4vhzZOpq7LjbtESUpN","level":3,"time":"2024-09-07T14:34:22+00:00","remoteAddr":"","user":"--","app":"fulltextsearch_elasticsearch","method":"","url":"--","message":"Retry 0: cURL error 56: Recv failure: Connection reset by peer (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://user:password@************.eu-central-2.aws.elastic-cloud.com:9243/service_index/_doc/files%3A45307323?pipeline=attachment","userAgent":"--","version":"29.0.6.1","data":{"app":"fulltextsearch_elasticsearch"},"id":"66dc66602286d"}

Hint: this works curl --user user:password -X GET "https://**************.eu-central-2.aws.elastic-cloud.com:9243/_cat/indices?v=true&s=index&pretty"

curl --user user:password -X GET "http://**************.eu-central-2.aws.elastic-cloud.com:9243/_cat/indices?v=true&s=index&pretty"

IMHO AWS elastic is not configured to handle http requests

as a quick fix I changed lib/Vendor/Http/Discovery/Psr17Factory.php to remove the error. IMHO the prefix http or https must not be hard coded, but taken from the "Address of the Servlet"

176     private function buildUriFromGlobals(UriInterface $uri, array $server) : UriInterface
177     {
178         $uri = $uri->withScheme(!empty($server['HTTPS']) && 'off' !== \strtolower($server['HTTPS']) ? 'https' : 'http');
179         $hasPort = \false;
180         if (isset($server['HTTP_HOST'])) {
181 # fgf  $parts = \parse_url('http://' . $server['HTTP_HOST']);
182             $parts = \parse_url('https://' . $server['HTTP_HOST']);
183             $uri = $uri->withHost($parts['host'] ?? 'localhost');
184             if ($parts['port'] ?? \false) {
185                 $hasPort = \true;
186                 $uri = $uri->withPort($parts['port']);

ferdiga avatar Sep 07 '24 15:09 ferdiga