summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/rewrite
diff options
context:
space:
mode:
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