From 61fcf900e59e895a3a258756b6e198f764b7a4e2 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquet Date: Mon, 5 Nov 2018 10:04:49 -0500 Subject: [PATCH] Clean requested path before signing request The URL signed by AWS signer must be exactly the same as the one requested to AWS by the go HTTP client. This fix aims to mimic the cleanup performed by the go client. --- aws-es-proxy.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aws-es-proxy.go b/aws-es-proxy.go index 4e47770a..1a0af49b 100644 --- a/aws-es-proxy.go +++ b/aws-es-proxy.go @@ -12,6 +12,7 @@ import ( "net/http/httputil" "net/url" "os" + "path" "regexp" "strings" "time" @@ -129,6 +130,7 @@ func (p *proxy) ServeHTTP(w http.ResponseWriter, r *http.Request) { ep := *r.URL ep.Host = p.host ep.Scheme = p.scheme + ep.Path = path.Clean(ep.Path) req, err := http.NewRequest(r.Method, ep.String(), r.Body) if err != nil {