Multi-tenant under shared domain name

Topics: Administration, Customizing Orchard
Feb 27, 2012 at 10:21 PM

Is it possible to run multiple tenants under a single domain name, without using subdomains, but rather using a virtual directory or path prefix for one of the tenants?  Have tried a bit to no avail; is multi-tenancy only intended for use with distinct FQDNs?

Desired scenario:

Tenant 1: mydomain.com

Tenant 2: mydomain.com/tenant2

Thank you kindly!

Coordinator
Feb 27, 2012 at 10:29 PM

YES !

When you create a tenant, there is the Host, and Url Prefix. The prefix is used as the path prefix discriminator. I have personally never tried it, please report if it works as you expected.

Feb 27, 2012 at 11:56 PM

Interesting behavior; could be doing it wrong.  I am attempting to change an existing tenant which lives at a subdomain, so that it instead lives at the top level domain and under a path, as noted above.

I see that the Settings.txt file contains RequestUrlPrefix, although the /Admin/MultiTenancy/Edit/ view does not expose the RequestUrlPrefix to set the value via the form.  When I update this value manually in the Settings.txt file and refresh the Admin page which displays the list of tenants, the tenant's URL is rendered correctly with the prefix, e.g., http://mydomain.com/tenant2

However, when I try to navigate to that URL, the page redirects to the home page of the default tenant.  I could step through the code and find out why, but thought something might come to mind if I posted here...

Feb 28, 2012 at 1:33 AM

Please disregard comment regarding redirect; it is related to something we had customized, but not related to the multi-tenant functionality.

Suffice to say that the scenario above (repeated here) doesn't work so well.

Tenant 1: mydomain.com

Tenant 2: mydomain.com/tenant2

Coordinator
Feb 28, 2012 at 5:53 AM

I never knew this feature existed but eh, apparently it does. If it doesn't work so well, please file a bug describing how it doesn't. Thanks.

Developer
Apr 24, 2012 at 11:16 AM

Hi!

Has anyone got any new information about it? I'd like to use a tenant with this "mydomain.com/tenant" type of url.
I could edit the url of the tenant on the admin interface and it renders correctly (so I didn't have the same problem ayitey mentioned), but the link redirects to the default site's 404 error page.

Developer
Apr 24, 2012 at 5:24 PM

With either variation of settings this seems not to work for mydomain.com/sub

  • RequestUrlHost: null
    RequestUrlPrefix: sub
  • RequestUrlHost: mydomain.com
    RequestUrlPrefix: sub
  • RequestUrlHost: mydomain.com/sub
    RequestUrlPrefix: null

The main tenant comes in with a 404.

Sep 18, 2013 at 10:21 PM
Trying to get this scenario working as well using Orchard 1.7.1

tenant 1: mydomain.com
tenant 2: mydomain.com/tenant2

functionality seems to be working fine when i am logged in as the super user of tenant 2 (I can access both 'sites' fully). However, when I attempt to access mydomain.com/tenant2 as a guest I get an http 500 error.

Extra note: i am able to access the login page for tenant 2 as a guest.
Coordinator
Sep 18, 2013 at 10:22 PM
Please provide the full stack trace: 500 means only that something went wrong on the server. You can find stack traces in app_data\logs.
Sep 18, 2013 at 10:43 PM
Edited Sep 18, 2013 at 10:46 PM
Here are the last few entries of what was in the log file. Note that these are over 5 hours since I have been getting the current 500 error.

2013-09-18 13:10:04,992 [28] Orchard.Tasks.BackgroundService - Error while processing background task
NHibernate.TransactionException: Transaction not connected, or was disconnected
at NHibernate.Transaction.AdoTransaction.CheckNotZombied()
at NHibernate.Transaction.AdoTransaction.Commit()
at Orchard.Data.SessionLocator.RequireNew(IsolationLevel level) in d:\Builds\OrchardFull\src\Orchard\Data\SessionLocator.cs:line 62
at Orchard.Data.SessionLocator.RequireNew() in d:\Builds\OrchardFull\src\Orchard\Data\SessionLocator.cs:line 49
at Orchard.Tasks.BackgroundService.Sweep() in d:\Builds\OrchardFull\src\Orchard\Tasks\BackgroundService.cs:line 29
2013-09-18 13:10:04,993 [28] Orchard.Tasks.BackgroundService - Error while processing background task
NHibernate.TransactionException: Transaction not connected, or was disconnected
at NHibernate.Transaction.AdoTransaction.CheckNotZombied()
at NHibernate.Transaction.AdoTransaction.Rollback()
at Orchard.Data.SessionLocator.RequireNew(IsolationLevel level) in d:\Builds\OrchardFull\src\Orchard\Data\SessionLocator.cs:line 56
at Orchard.Data.SessionLocator.RequireNew() in d:\Builds\OrchardFull\src\Orchard\Data\SessionLocator.cs:line 49
at Orchard.Tasks.BackgroundService.Sweep() in d:\Builds\OrchardFull\src\Orchard\Tasks\BackgroundService.cs:line 29
2013-09-18 13:10:04,994 [28] Orchard.Tasks.BackgroundService - Error while processing background task
NHibernate.TransactionException: Transaction not connected, or was disconnected
at NHibernate.Transaction.AdoTransaction.CheckNotZombied()
at NHibernate.Transaction.AdoTransaction.Rollback()
at Orchard.Data.SessionLocator.RequireNew(IsolationLevel level) in d:\Builds\OrchardFull\src\Orchard\Data\SessionLocator.cs:line 56
at Orchard.Data.SessionLocator.RequireNew() in d:\Builds\OrchardFull\src\Orchard\Data\SessionLocator.cs:line 49
at Orchard.Tasks.BackgroundService.Sweep() in d:\Builds\OrchardFull\src\Orchard\Tasks\BackgroundService.cs:line 29
2013-09-18 13:10:04,995 [28] Orchard.Data.SessionLocator - Error while disposing the transaction.
NHibernate.TransactionException: Transaction not connected, or was disconnected
at NHibernate.Transaction.AdoTransaction.CheckNotZombied()
at NHibernate.Transaction.AdoTransaction.Rollback()
at Orchard.Data.SessionLocator.Dispose() in d:\Builds\OrchardFull\src\Orchard\Data\SessionLocator.cs:line 84
Coordinator
Sep 18, 2013 at 10:46 PM
Weird. Please file a bug with that information.
Sep 18, 2013 at 10:51 PM
Will do. Thanks.