Base solution for your next web application
Open Closed

Multi-tenancy and subdomains #5349


User avatar
0
mikatmlvertti created

Hi. I have tried to set up our merged Angular project to work with subdomains but if I go to url tenantname.oursite.net, it will open the site, but it tryes to login to the HOST, not Tenant. So the tenant name part is being ignored in url. Does anyone have a clue where we have gone wrong?

We have put Angular project src/assets/appconfig.production.json "remoteServiceBaseUrl": "https://{TENANCY_NAME}.oursite.net", "appBaseUrl": "https://{TENANCY_NAME}.oursite.net",

and I have tried to set appsettings.production.json WebSiteRootAddress and ClientRootAddress same way.

In the documents [https://aspnetzero.com/Documents/Development-Guide-Angular#configuration])

Tenancy name can also be configured for remoteServiceBaseUrl as similar but when it is necessary?

If I follow these instructions [https://forum.aspnetboilerplate.com/viewtopic.php?f=5&t=10132&hilit=TENANCY_NAME&start=10]) I should only set appBaseUrl and ClientRootAddress with TENANCY_NAME placeholder.

and here [https://forum.aspnetboilerplate.com/viewtopic.php?f=5&t=10422&hilit=wwwroot+dist#p24966]) is suggested that I should put placeholder on every url..


4 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    @MikaTmlVertti,

    1. Could you also share your server side config file ?
    2. Could you also check browser console and see what is the request url to server when you visit tenantname.oursite.net ?
    3. I think tenant with a name "tenantname" already exists in the database, right ?
  • User Avatar
    0
    mikatmlvertti created

    Hi. I send some detail info to your info@aspnetzero.

    1. We set all our server side config data from azures enviromental settings. But for the summarise: App:ClientRootAddress -> https://{TENANCY_NAME}.oursite.net App:WebSiteRootAddress -> https://{TENANCY_NAME}.oursite.net

    2. The request url is same: tenantname.oursite.net

    3. Yes, tenant name is "ABC" and in url it is "abc". We are able to select it when {TENANCY_NAME} is not being used.

  • User Avatar
    0
    mikatmlvertti created

    Problem solved with this: There was wrong parameter in appsettings.production.json, WebSiteRootAddress should be ServerRootAddress. After this was changed, it started to work correctly.

    If anyone else is going to use Azure and Angular (merged), put {TENANCY_NAME}.yourCustomUrl.end to each setting, and in Azure, make sure Custom domains has *.yourCustomUrl.end and yourCustomUrl.end assigned to the site.

    Thank you for your support!

  • User Avatar
    0
    ismcagdas created
    Support Team

    Thanks :). It is also fixed here <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/1380">https://github.com/aspnetzero/aspnet-ze ... ssues/1380</a>.