mirror of
https://github.com/kataras/iris.git
synced 2026-01-10 05:25:58 +00:00
add accesslog+proxy example
This commit is contained in:
@@ -397,8 +397,12 @@ func StripPrefix(prefix string, h context.Handler) context.Handler {
|
||||
canonicalPrefix = toWebPath(canonicalPrefix)
|
||||
|
||||
return func(ctx *context.Context) {
|
||||
if p := strings.TrimPrefix(ctx.Request().URL.Path, canonicalPrefix); len(p) < len(ctx.Request().URL.Path) {
|
||||
ctx.Request().URL.Path = p
|
||||
u := ctx.Request().URL
|
||||
if p := strings.TrimPrefix(u.Path, canonicalPrefix); len(p) < len(u.Path) {
|
||||
if p == "" {
|
||||
p = "/"
|
||||
}
|
||||
u.Path = p
|
||||
h(ctx)
|
||||
} else {
|
||||
ctx.NotFound()
|
||||
|
||||
Reference in New Issue
Block a user