From 67d32e6779b8e4f67fb0902b06210596371ead7f Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Tue, 21 May 2019 13:10:14 -0600 Subject: Fix up matchers tests and take care of TODO in rewrite --- modules/caddyhttp/rewrite/rewrite.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'modules/caddyhttp/rewrite') diff --git a/modules/caddyhttp/rewrite/rewrite.go b/modules/caddyhttp/rewrite/rewrite.go index 1afb8a4..9bd01c0 100644 --- a/modules/caddyhttp/rewrite/rewrite.go +++ b/modules/caddyhttp/rewrite/rewrite.go @@ -36,17 +36,15 @@ func (rewr Rewrite) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddy } if rewr.URI != "" { - // TODO: clean this all up, I don't think it's right - oldURI := r.RequestURI newURI := repl.ReplaceAll(rewr.URI, "") + u, err := url.Parse(newURI) if err != nil { return caddyhttp.Error(http.StatusInternalServerError, err) } r.RequestURI = newURI - r.URL.Path = u.Path if u.RawQuery != "" { r.URL.RawQuery = u.RawQuery -- cgit v1.2.3