-
-
Notifications
You must be signed in to change notification settings - Fork 409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Path Identification #173
Comments
@stancl will be great if domain, subdomain and path identification can be supported at the same time. Then your SaaS can have:
|
I think this is a good consideration given the things I've been changing about tenant identification lately. The ideal scenario would be that both domain-based identification and path-based identification would work. I think with 2.0.1, you should be able to use a route group with the InitializeTenancy middleware for this. However, in 2.1.0 I'm changing the InitializeTenancy middleware to be executed globally. It initializes tenancy if the current domain is not a central domain, and then when the route middleware is being executed, the PreventAccessFromTenantDomains middleware checks that central routes can't be visited on tenant domains, and vice versa. The reason I'm changing this is that it's the only way to initialize tenancy before running controller constructors. So you do need some concept of a tenant domain. However, I think you should be able to use a single subdomain not listed in the exempt_domains config, such as app.yoursaas.com and then inside you'd initialize tenancy manually inside a route group. Though the global middleware initializes tenancy using a domain, hmm. I think I'll make the middleware swappable. Anyway. I think that using subdomains, such as tenant1.yoursaas.com is good enough functionality. But, if possible, I'd want a solution that lets you use path-based identification too. |
From a code design perspective, I'd like the package to be able to do this. From a practical perspective, all the use cases you listed can be solved by using |
Hi @stancl, Thanks. |
Yeah, it's really the best solution. The app will just work, certificate and DNS management remains the same, and Vapor does support multiple third level domains. |
Closing in favor of #207 |
Description
This great package ONLY support domain/subdomain identification.
Path identification would be identifying the tenant based on a part of the URL path, specifically the first section after the domain. An example of this would be
where "tenant-slug" is the tenant identifier.
Even we can use the domain too in case you want to reuse the domains table:
in this case "tenant1.com" is the tenant identifier.
Basically we should be able to use: "slug", "uuid" or "domain".
Why this should be added
Thanks!
The text was updated successfully, but these errors were encountered: