Base solution for your next web application
Open Closed

Login from subdomain Tenant not working using {TENANCY_NAME} #4253


User avatar
0
mudaser created

Hello Everyone

I am trying to login to tenant using subdomain like tenant.domain.com/account/login but I am getting error "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable." My configuration includes addition of {TENANCY_NAME} in appBaseUrl in appconfig.json like http://{TENANCY_NAME}.localhost:4200

I have also added the same to appremoteurl but it returns an error during loading of tenant login page. So can anyone guide me how to solve this Or even if I can restrict somehow to login by a certain tenant by default instead of host user.


10 Answer(s)
  • User Avatar
    0
    bbakermmc created

    We don't usually use {Tenancy_Name} with our local/dev machines. If you remove it from the config when you goto login you can choose what tenant you want to use. Then in our Prod environment we have our build server add it back in and it works fine (Note you have have to have a wild card DNS and the bindings properly set for your domains to make it work)

  • User Avatar
    0
    ismcagdas created
    Support Team

    Thanks @BBakerMMC :).

    @Mudaser, as @BBakerMMC pointed out, it is hard to use subdomains in the local machine. But if you still want to do that, you need to modify your windows host file to redirect some of domains to your local IP (127.0.0.1) and in your local environment, you can only do that if you use port numbers.

  • User Avatar
    0
    mudaser created

    I have binded the wildcard in the domain by adding a A card with * and ip address My remoteServiceBaseUrl is left to default because adding {TENANCY_NAME} to it returnserror "Detail not sent by server" So I only included {TENANCY_NAME} in appBaseUrl like http://{TENANCY_NAME}.domain.com Now I can open using "tenant.domain.com" but upon sign in it opens host admin page by default rather than tenant dashboard page

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @Mudaser,

    Just to be sure, are you trying this on your local machine ? If so, you can follow a similar configuration like this:

    Angular app config

    {
      "remoteServiceBaseUrl": "http://{TENANCY_NAME}.localcore.aspnetzero.com:2021",
      "appBaseUrl": "http://{TENANCY_NAME}.zerong2client.com:4445/"
    }
    

    Host app config

    "App": {
        "WebSiteRootAddress": "http://{TENANCY_NAME}.zerong2host.com:4444",
        "ClientRootAddress": "http://{TENANCY_NAME}.zerong2client.com:4445/",
        "CorsOrigins": "http://zerong2client.com:4445/,http://default.zerong2client.com:4445"
      }
    

    Windows app config

    127.0.0.1          zerong2client.com
    127.0.0.1          default.zerong2client.com
    127.0.0.1          zerong2host.com
    127.0.0.1          default.zerong2host.com
    

    You need to create two seperate websites on your local IIS and publish Angular app to localhost:4445, your host application to localhost:4444.

    When you configure them like I shared above, you can login as default tenant admin using <a class="postlink" href="http://default.zerong2client.com:4445">http://default.zerong2client.com:4445</a> link.

  • User Avatar
    0
    mudaser created

    Hello ismcagdas,

    Thanks for such an elaborate response to my query I am not using localhost, but deploying on the domain 'jackfolks.com' While the services (Web host ) is deployed on azure app 'http://miranzeasysecurewebapi.azurewebsites.net' I have used your configurations as you suggested but still facing issue. Below are my configuration files

    Angular app config

    "remoteServiceBaseUrl": "http://{TENANCY_NAME}.miranzeasysecurewebapi.azurewebsites.net",
      "appBaseUrl": "http://{TENANCY_NAME}.jackfolks.com"
    

    Host app config

    "ServerRootAddress": "http://{TENANCY_NAME}.miranzeasysecurewebapi.azurewebsites.net/",
        "ClientRootAddress": "http://{TENANCY_NAME}.jackfolks.com/",
        "CorsOrigins": "http://jackfolks.com,http://default.jackfolks.com"
    

    When I open the domain using 'jackfolks.com' or 'default.jackfolks.com' nothing is shown on the landing page except the error 'Details not sent by the server'

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @Mudaser,

    Your configuration is correct. I can access to <a class="postlink" href="http://miranzeasysecurewebapi.azurewebsites.net/swagger/">http://miranzeasysecurewebapi.azurewebs ... t/swagger/</a> but cannot access to <a class="postlink" href="http://default.miranzeasysecurewebapi.azurewebsites.net/swagger/">http://default.miranzeasysecurewebapi.a ... t/swagger/</a>.

    Probably you need to enable subdomains on azure but I don't know how to do that, you can search it on the web. If you cannot find a solution for that, we can try to help you.

  • User Avatar
    0
    mudaser created

    Hi @ismcagdas,

    I was trying to add wild card on Azure but I found out that without an SSL certificate it is not possible. So I was thinking that rather than deploying services on Azure, I can deploy it on the domain as well.

    But now do I have to deploy angular and Services Apps on separate domains or is it possible that I add the dist folder of angular to the web host folder. In this way I can deploy both on the same domain.

  • User Avatar
    0
    godrunner created

    @Mudase, I have a test deployment working on Azure with no SSL for now and it works fine. You just have to configure your site in the Azure "Custom domains" page for your app service and make the required changes to your DNS as per the instruction on that page.

  • User Avatar
    0
    mudaser created

    I have configured the custom domains on Azure with the addition of wild card for the domain. But still I am getting the same issue. Kindly Guide

    As a seperate solution for this problem, I have downloaded the code of aspnetzero as a single project. But I am having trouble running and making the required changes to run the whole project.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @Mudaser,

    Can you share your azure website addressse (both for host and angular) via email (<a href="mailto:[email protected]">[email protected]</a>) ? Also share your configuration files for Host and angular projects.