Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

fix: move legal routes after loading tenant info (#500)

Guilherme Oenning33a1538816d6
diff --git a/app/cmd/routes.go b/app/cmd/routes.go
index 4f8f7bc3b..f5bb1dfb7 100644
--- a/app/cmd/routes.go
+++ b/app/cmd/routes.go
@@ -20,8 +20,6 @@ func routes(r *web.Engine) *web.Engine {
r.Get("/-/health", handlers.Health())
r.Get("/robots.txt", handlers.RobotsTXT())
- r.Get("/privacy", handlers.LegalPage("Privacy Policy", "privacy.md"))
- r.Get("/terms", handlers.LegalPage("Terms of Service", "terms.md"))
assets := r.Group()
{
@@ -34,6 +32,9 @@ func routes(r *web.Engine) *web.Engine {
r.Use(middlewares.WebSetup())
r.Use(middlewares.Tenant())
+ r.Get("/privacy", handlers.LegalPage("Privacy Policy", "privacy.md"))
+ r.Get("/terms", handlers.LegalPage("Terms of Service", "terms.md"))
+
r.Post("/_api/tenants", handlers.CreateTenant())
r.Get("/_api/tenants/:subdomain/availability", handlers.CheckAvailability())
r.Get("/signup", handlers.SignUp())
diff --git a/app/middlewares/domain.go b/app/middlewares/domain.go
index 48afca89d..c336e3798 100644
--- a/app/middlewares/domain.go
+++ b/app/middlewares/domain.go
@@ -52,7 +52,9 @@ func MultiTenant() web.MiddlewareFunc {
// This is only valid for fider.io hosting
if (env.IsProduction() && hostname == "fider.io") ||
(env.IsDevelopment() && hostname == "dev.fider.io") {
- return c.Redirect("https://getfider.com")
+ if c.Request.URL.Path == "" || c.Request.URL.Path == "/" {
+ return c.Redirect("https://getfider.com")
+ }
}
tenant, err := c.Services().Tenants.GetByDomain(hostname)