diff options
| author | Fuwn <[email protected]> | 2021-08-25 17:43:21 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2021-08-25 17:43:21 -0700 |
| commit | c3e06e178f2ea82243abd7ce26c7a6d3f19f31ad (patch) | |
| tree | 384331d6610605234f949ca27c0f3f4d37045f46 /route.go | |
| parent | fix(route): correct redirect route (diff) | |
| download | space-c3e06e178f2ea82243abd7ce26c7a6d3f19f31ad.tar.xz space-c3e06e178f2ea82243abd7ce26c7a6d3f19f31ad.zip | |
feat(route): redirect route does full redirect
Diffstat (limited to 'route.go')
| -rw-r--r-- | route.go | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -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) + } }) } |