aboutsummaryrefslogtreecommitdiff
path: root/route.go
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-08-25 17:43:21 -0700
committerFuwn <[email protected]>2021-08-25 17:43:21 -0700
commitc3e06e178f2ea82243abd7ce26c7a6d3f19f31ad (patch)
tree384331d6610605234f949ca27c0f3f4d37045f46 /route.go
parentfix(route): correct redirect route (diff)
downloadspace-c3e06e178f2ea82243abd7ce26c7a6d3f19f31ad.tar.xz
space-c3e06e178f2ea82243abd7ce26c7a6d3f19f31ad.zip
feat(route): redirect route does full redirect
Diffstat (limited to 'route.go')
-rw-r--r--route.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/route.go b/route.go
index 8bfe52a..bfdd649 100644
--- a/route.go
+++ b/route.go
@@ -154,12 +154,12 @@ func legacySupport(baseRoute string) {
})
}
-func createRedirectRoute(route string, redirectRoute string) {
- // TODO: Redirect with path
- //
- // Example:
- // /x/something -> /proxy/something instead of /x/something -> /proxy
+func createRedirectRoute(route string, redirectRoute string, mask bool) {
g.Handle(route, func(c gig.Context) error {
- return c.NoContent(gig.StatusRedirectPermanent, redirectRoute)
+ if mask {
+ return c.NoContent(gig.StatusRedirectPermanent, redirectRoute+c.URL().Path[2:]) // - /x
+ } else {
+ return c.NoContent(gig.StatusRedirectPermanent, redirectRoute)
+ }
})
}