summaryrefslogtreecommitdiff
path: root/modules/caddyhttp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/caddyhttp')
-rw-r--r--modules/caddyhttp/rewrite/caddyfile.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/caddyhttp/rewrite/caddyfile.go b/modules/caddyhttp/rewrite/caddyfile.go
index 6ec51c0..e69ea21 100644
--- a/modules/caddyhttp/rewrite/caddyfile.go
+++ b/modules/caddyhttp/rewrite/caddyfile.go
@@ -16,6 +16,7 @@ package rewrite
import (
"strconv"
+ "strings"
"github.com/caddyserver/caddy/v2/caddyconfig/httpcaddyfile"
"github.com/caddyserver/caddy/v2/modules/caddyhttp"
@@ -60,6 +61,9 @@ func parseCaddyfileStripPrefix(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHand
return nil, h.ArgErr()
}
rewr.StripPathPrefix = h.Val()
+ if !strings.HasPrefix(rewr.StripPathPrefix, "/") {
+ rewr.StripPathPrefix = "/" + rewr.StripPathPrefix
+ }
if h.NextArg() {
return nil, h.ArgErr()
}