From e530c28b95764621a436a2a82ec7d233679b9cfd Mon Sep 17 00:00:00 2001 From: saravanan30erd Date: Tue, 2 Jun 2020 12:53:19 +0400 Subject: [PATCH] Issue #70 - add the kbn-xsrf header --- aws-es-proxy.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/aws-es-proxy.go b/aws-es-proxy.go index dc1a17ef..99d3f6b0 100644 --- a/aws-es-proxy.go +++ b/aws-es-proxy.go @@ -372,7 +372,8 @@ func (p *proxy) ServeHTTP(w http.ResponseWriter, r *http.Request) { } // Recent versions of ES/Kibana require -// "kbn-version" and "content-type: application/json" +// "content-type: application/json" and +// either "kbn-version" or "kbn-xsrf" // headers to exist in the request. // If missing requests fails. func addHeaders(src, dest http.Header) { @@ -383,6 +384,10 @@ func addHeaders(src, dest http.Header) { if val, ok := src["Content-Type"]; ok { dest.Add("Content-Type", val[0]) } + + if val, ok := src["Kbn-Xsrf"]; ok { + dest.Add("Kbn-Xsrf", val[0]) + } } // Signer.Sign requires a "seekable" body to sum body's sha256