Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

Redirect to getfider.com when no tenant is specified (#116)

Guilherme Oenning3b7b9d7d0959
diff --git a/app/middlewares/domain.go b/app/middlewares/domain.go
index b41f2aad9..2b5d5d699 100644
--- a/app/middlewares/domain.go
+++ b/app/middlewares/domain.go
@@ -47,6 +47,13 @@ func MultiTenant() web.MiddlewareFunc {
return c.Failure(err)
}
+ // If no tenant is specified, redirect user to getfider.com
+ // This is only vadid for fider.io hosting
+ if (env.IsProduction() && hostname == "fider.io") ||
+ (env.IsDevelopment() && hostname == "dev.fider.io") {
+ return c.Redirect(http.StatusTemporaryRedirect, "http://getfider.com")
+ }
+
if hostname == stripPort(u.Host) {
return next(c)
}
diff --git a/app/pkg/validate/domain.go b/app/pkg/validate/domain.go
index 091a67a67..09f8e847e 100644
--- a/app/pkg/validate/domain.go
+++ b/app/pkg/validate/domain.go
@@ -29,7 +29,7 @@ func Subdomain(tenants storage.Tenant, subdomain string) *Result {
switch subdomain {
case
- "signup", "fider", "admin", "setup", "about", "wecanhearyou",
+ "signup", "fider", "admin", "setup", "about", "wecanhearyou", "dev",
"billing", "www", "web", "translate", "help", "support", "staging":
return Failed([]string{fmt.Sprintf("%s is a reserved subdomain.", subdomain)})
}