Base solution for your next web application
Open Closed

How do you bind different tenants to different domains? #3734


User avatar
0
zepan created

How do you bind different tenants to different domains? There are users not logged in, how to judge is under different tenants? Example: some public external pages can be viewed without user login, but their respective tenants cannot see each other.


3 Answer(s)
  • User Avatar
    0
    alper created
    Support Team

    You can read the doc about configuring for subdomain: <a class="postlink" href="https://aspnetzero.com/Documents/Development-Guide-Core#web-site-root-url">https://aspnetzero.com/Documents/Develo ... e-root-url</a>

    Subdomain mapping is done with subdomain names; eg: mytenant1.sample.com , mytenant2.sample.com mytenant1 and mytenant2 are tenancy names. so basically it matches from this name.

    You don't want to be seen a public page to different tenants. But this is not possible as far as this is a public page.

  • User Avatar
    0
    zepan created

    I mean I have two tenants (A, B) : A released a news NewsA, B released a news NewsB, news is visible to all people, because the data stored in the same database, I hope the terminals to access the A website to only see NewsA, but not NewsA, NewsB. How do data on public pages be filtered through tenantId when multi tenant is used?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @zepan,

    When you access an address for example: tenantA.yoursite.com, ABP framework can recognize tenantA from your subdomain and sets TenantId value on the session. After that, this value (AbpSession.TenantId) is used in all queries, so TenantB's records will not be retrieved from database.

    You can also check this documentation <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/Multi-Tenancy#data-filters">https://aspnetboilerplate.com/Pages/Doc ... ta-filters</a>.

    Please let us know if there are unclear points.

    Thanks.