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

tenancy name in URL http://mydomain.com/{TENANCY_NAME}/ #10459


User avatar
0
SRTMDEV created

Hi ANZ,

I would like to implement tenancy name in URL for multi tenant, currently i setup subdomain as tenancy name as ANZ support. I would like to have tenancy name in URL as below,

http://mydomain.com/{TENANCY_NAME}/account/login

I tried to setup however its not working.

Is there any configuration changes or other way to achive this feature?

Thanks, SRTMDEV


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

    Hi @SRTMDEV

    What problem did you face, could you share it as well ?

  • User Avatar
    0
    SRTMDEV created

    Hi,

    Its return internal server error for below method 404,

    Thanks

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @SRTMDEV

    It seems like the URL is constructed wrongly. Is there a chance for us to test this on your app ?

    Thanks,

  • User Avatar
    0
    SRTMDEV created

    Hi @ismcagdas,

    find code for angular and api in below linkg,

    Link removed for security reasons

    Thanks.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi **@SRTMDEV **

    Since this is a public place, the link was visible to everyone. Is it possible to share the link with [email protected] ? I couldn't get the link before it was removed.

    Thanks,

  • User Avatar
    0
    SRTMDEV created

    Hi @ismcagdas,

    Please check [email protected] i sent mail few days before with issue id.

    Thanks, SRTMDEV

  • User Avatar
    0
    SRTMDEV created

    Hi,

    any update on this context?

  • User Avatar
    0
    SRTMDEV created

    Hi @ismcagdas,

    Any update on this context,

    Please response we need an priority base solution.

    Thanks, SRTMDEV

  • User Avatar
    0
    musa.demir created

    Hi @SRTMDEV

    It does not work beacuse you should also change that code part. https://github.com/aspnetzero/aspnet-zero-core/blob/39f9c6ab314eb56580e33205c426cfb11f618519/angular/src/shared/common/nav/app-url.service.ts#L39-L44 It searches for AppUrlService.tenancyNamePlaceHolder + '.' and replaces it. You should search and replace "/"+AppUrlService.tenancyNamePlaceHolder.

    Since it does not replace / your approoturl has additional /. See :

    if (baseUrl.indexOf('/' + AppUrlService.tenancyNamePlaceHolder) >= 0) {
    	baseUrl = baseUrl.replace('/' + AppUrlService.tenancyNamePlaceHolder, AppUrlService.tenancyNamePlaceHolder);
    	if (tenancyName) {
    		tenancyName = '/' + AppUrlService.tenancyNamePlaceHolder;
    	}
    }
    
  • User Avatar
    0
    SRTMDEV created

    Hi,

    I applied this changes, however still i am getting error 404 for abpuserconfiguration.

    Is there any changes need to apply on server side. I applied below changes in appsettings.json

    Thanks, SRTMDEV

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @SRTMDEV

    Sorry, I missunderstand the question wrong at first. In Angular version, it is not supported to use TENANCY_NAME as a subpath in your URLs. You can try using it as a subdomain.

  • User Avatar
    0
    SRTMDEV created

    Hi @ismcagdas,

    Its also not working API side also.

    Any suggestion to achive this functionality ?

    Thanks, SRTMDEV

  • User Avatar
    0
    musa.demir created

    Hi @SRTMDEV

    You should also change the tenancy resolver in server side. Here is where aspnetboilerplate resolves tenant: https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp.AspNetCore/AspNetCore/MultiTenancy/DomainTenantResolveContributor.cs You can please create your own implementation that inherits ITenantResolveContributor and implement it as seen below.

                Configuration.MultiTenancy.Resolvers.Add<MyCustomTenantResolveContributor>();
    
  • User Avatar
    0
    SRTMDEV created

    Hi,

    Thanks for prompt response.

    I will try and update you if any issue.

    Thanks, SRTMDEV

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @SRTMDEV

    It is also hard to implement this on server side.

    Consider a URL like this -> https://mywebsite.com/tenant1/app/users. Normally this URL needs to use Users controller under the area App. So, you can configure the ASP.NET Core routing to not handle the first parameter after the URL. In that case, you don't need to write a custom Tenant resolver.