http: A little more polish on rewrite handler and try_files directive

This commit is contained in:
Matthew Holt
2020-01-11 13:47:42 -07:00
parent d876de61e5
commit 25dea2903e
5 changed files with 51 additions and 48 deletions
+4 -3
View File
@@ -32,7 +32,8 @@ func init() {
//
// rewrite [<matcher>] <to>
//
// The <to> parameter becomes the new URI.
// Only URI components which are given in <to> will be set in the resulting URI.
// See the docs for the rewrite handler for more information.
func parseCaddyfileRewrite(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler, error) {
var rewr Rewrite
for h.Next() {
@@ -58,7 +59,7 @@ func parseCaddyfileStripPrefix(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHand
if !h.NextArg() {
return nil, h.ArgErr()
}
rewr.StripPrefix = h.Val()
rewr.StripPathPrefix = h.Val()
if h.NextArg() {
return nil, h.ArgErr()
}
@@ -77,7 +78,7 @@ func parseCaddyfileStripSuffix(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHand
if !h.NextArg() {
return nil, h.ArgErr()
}
rewr.StripSuffix = h.Val()
rewr.StripPathSuffix = h.Val()
if h.NextArg() {
return nil, h.ArgErr()
}