Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Selecting tenant with subdomain not working #5665


User avatar
0
aiqbal created

Hi,

We are trying to get asp.net zero to detect the tenant based on the url but we can't get this to work. We are using the .net core angular solution.

Here are the settings we have for the angular side.

"remoteServiceBaseUrl": "https://svc.ourdomain.com", "appBaseUrl": "https://{TENANCY_NAME}.ourdomain.com",

And here are the settings on the service side.

"ServerRootAddress": "https://svc.ourdomain.com/", "ClientRootAddress": "https://{TENANCY_NAME}.ourdomain.com/",

Any idea what we are doing wrong?

Thanks


8 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    You need to replace the two Urls with {TENANCY_NAME}

    Please see the documentation: https://aspnetzero.com/Documents/Development-Guide-Angular?#angular-solution

  • User Avatar
    0
    aiqbal created

    We tried that, and several other combinations, but none of them have worked. I'm wondering if it's because of how we have setup the website and service on IIS.

    In IIS we created two websites. One holds the service and the other holds the angular website.

    Currently we are trying to get this running on our QA environment so you would go to qa.ourdomain.com to get to the website. And if you wanted to reach the service then you would go to svcqa.ourdomain.com. If we leave the settings with those values then the website works fine but you need to change the tenant manually.

    If we add {TENANCY_NAME} to both the service and website then the site breaks because the website can't find the service. The service only works when you go to svcqa.ourdomain.com.

    So I am confused as to how people are hosting this in their environments. Should both the angular and service be a single website in ISS? Or instead of having our service endpoint be a subdomain of ourdomain.com should it have its own separate domain? ourdomainsvc.com?

  • User Avatar
    0
    ismcagdas created
    Support Team

    @aiqbal you also need to bind your subdomains to the same app as explained in the document @maliming shared;

    1. We should configure DNS to redirect all subdomains to a static IP address. To declare 'all subdomains', we can use wildcard like *.mydomain.com.
    2. We should configure IIS to bind this static IP to our application.

    So, have you done that ? Maybe it is the problem.

  • User Avatar
    0
    aiqbal created

    That says that we need to bind the subdomains to the same app but we have two apps (websites running on IIS). One for the angular portion and one for the service portion. That is why I am wondering if we are hosting this incorrectly.

    As for the subdomain, so far we have only forwarded subdomains for the specific tenants to the same ip address. So for example;

    tenant1.ourdomain.com - goes to the angular site tenant2.ourdomain.com - goes to the angular site

    And if you wanted to reach the service then you would go to svc.ourdomain.com.

    How have you setup the service and angular website to run on iis?

  • User Avatar
    0
    aiqbal created

    I have been experimenting with this over the last day and I was able to get it to work on my local environment provided that the service and the website are running under the same domain but in different ports. So that is great news. We can make it work now.

    But I'm curious if this is the only way in which it will work because it would mean that we would need to buy a separate domain for each of our environments (eg: dev-oursite.com, qa-oursite.com, oursite.com) where in the past we had only purchased one domain and then used the subdomain (eg: qa.oursite.com) to control which environment we are connecting too.

    This would also mean that we would need to open an additional port in the server for the website to be able to talk to the service. This isn't something we have had to do before so its caught us by surprise.

  • User Avatar
    0
    ismcagdas created
    Support Team

    @aiqbal, if you want to host both sides in separate websites, then Angualr project must sebd Abp.TenantId in the request header. I couldn't remember if it exist in the current solution or not.

    Could you check that ?

  • User Avatar
    0
    ismcagdas created
    Support Team

    @aiqbal

    any news ?

  • User Avatar
    0
    alper created
    Support Team

    closing the question as no response for 7 days...