Skip to content

Elasticsearch high-level REST client doesn't send additional HTTP headers while querying for Elasticsearch version #117266

Closed
@mikepenzo

Description

@mikepenzo

Elasticsearch Version

Elasticsearch high-level REST client 7.17

Installed Plugins

No response

Java Version

openjdk version "17.0.13" 2024-10-15

OS Version

Linux 6.1.0-27-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.115-1 (2024-11-01) x86_64 GNU/Linux

Problem Description

If Elasticsearch high-level REST client is used in front of an API gateway, such as Spring Cloud Gateway, it sometimes needs to be configured to send custom additional HTTP headers in order to be validated by the API gateway (these headers might contain mandatory values to submit).
We discovered that the client checks the version of Elasticsearch without sending the additional headers. It anyway ignores the problem if it gets HTTP codes 401 or 403, but not if the returned code is HTTP 400.
In my humble opinion, the root cause of this error is not sending the additional headers. Can you please fix that?

Steps to Reproduce

  1. Configure Spring Cloud Gateway to stop calls without a set of mandatory HTTP headers. Be sure that it returns 400 and not 401/403 HTTP codes.
  2. Configure the high-level client with the mandatory HTTP headers.
  3. Run a generic call with the high-level gateway. Even if the call is "white-listed", the client will return an error anyway.

Logs (if relevant)

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions