diff --git a/x-pack/plugins/ml/server/lib/request_authorization.ts b/x-pack/plugins/ml/server/lib/request_authorization.ts index 01df0900b96f..d40909a3a3a4 100644 --- a/x-pack/plugins/ml/server/lib/request_authorization.ts +++ b/x-pack/plugins/ml/server/lib/request_authorization.ts @@ -7,7 +7,9 @@ import { KibanaRequest } from 'kibana/server'; export function getAuthorizationHeader(request: KibanaRequest) { - return { - headers: { 'es-secondary-authorization': request.headers.authorization }, - }; + return request.headers.authorization === undefined + ? {} + : { + headers: { 'es-secondary-authorization': request.headers.authorization }, + }; }