Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ferdiga opened this issue Sep 7, 2024 · 0 comments

Comments

@ferdiga
Copy link

ferdiga commented Sep 7, 2024

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']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant