summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/rewrite
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2019-05-21 13:10:14 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2019-05-21 13:10:14 -0600
commit67d32e6779b8e4f67fb0902b06210596371ead7f (patch)
treeb5cf0490ba4d685d1af7c21e154c500a3426db45 /modules/caddyhttp/rewrite
parent9d54f655aa7698ce683786dfc31b6f11df3c89d2 (diff)
Fix up matchers tests and take care of TODO in rewrite
Diffstat (limited to 'modules/caddyhttp/rewrite')
-rw-r--r--modules/caddyhttp/rewrite/rewrite.go4
1 files changed, 1 insertions, 3 deletions
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