[PATCH kimchi] Include query parameters when using the 'redirect' directive
Export this patch
---
directives.go | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/directives.go b/directives.go
index 9a57ff4..8891d9e 100644
--- a/directives.go
+++ b/directives.go
@@ -229,7 +229,16 @@ var backends = map[string]parseBackendFunc{
if err := dir.ParseParams(&to); err != nil {
return nil, err
}
- return http.RedirectHandler(to, http.StatusFound), nil
+
+ var redirector http.HandlerFunc = func(w http.ResponseWriter, r *http.Request) {
+ to := to
+ if len(r.URL.RawQuery) > 0 {
+ to += "?" + r.URL.RawQuery
+ }
+ http.Redirect(w, r, to, http.StatusFound)
+ }
+
+ return redirector, nil
},
}
--
2.38.1