1
0
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:
Gerasimos (Makis) Maropoulos
2020-09-19 17:47:44 +03:00
parent fc2aada3c7
commit a04a6b5011
9 changed files with 199 additions and 28 deletions

View File

@@ -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()