Skip to content

Warning headers are removed on any failure #75739

@pgomulka

Description

@pgomulka

Whenever a request fails, the previously emitted response header warnings are removed from a response.
This was intentionally done so that when authentication fails, there would be no warnings presented to a user.
However when a failure is not related to authentication, headers are removed as well.
I suspect this behaviour fails only when security is enabled

introduced by #64948

reproduction steps:

  1. create an index
  2. send a request that emits a warning and also fails. For instance a rest api compatible typed search endpoint - emits deprecation warning- and typed query - fails parsing.

--url http://localhost:9200/test1/sometype/_search
--header ‘Accept: application/vnd.elasticsearch+json;compatible-with=7’
--header ‘Authorization: Basic ZWxhc3RpYzpwYXNzd29yZA==’
--header ‘Content-Type: application/vnd.elasticsearch+json;compatible-with=7’
--header ‘X-Opaque-ID: he’
--data ‘{
“query”: {
“type”:{
“value”: “_doc”
}
}
}’

`Warning` headers are missing

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions