mirror of
https://github.com/caddyserver/caddy.git
synced 2025-06-03 10:43:13 +08:00
Rewrite: Use middleware.Replacer for simple rule.
This commit is contained in:
@ -52,7 +52,11 @@ func (s SimpleRule) Rewrite(r *http.Request) bool {
|
||||
// take note of this rewrite for internal use by fastcgi
|
||||
// all we need is the URI, not full URL
|
||||
r.Header.Set(headerFieldName, r.URL.RequestURI())
|
||||
r.URL.Path = s.To
|
||||
|
||||
// replace variables
|
||||
to := path.Clean(middleware.NewReplacer(r, nil, "").Replace(s.To))
|
||||
|
||||
r.URL.Path = to
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
Reference in New Issue
Block a user