Hi,
I am looking for solution to set Tenant automatically based on the current host url. I reviewed the availale documents of abp but couldn't found any way for this.
Please share insight on this.
Thanks
6 Answer(s)
-
0
Hi
Please see https://docs.abp.io/en/abp/latest/Multi-Tenancy#domain-tenant-resolver.
-
0
Hi,
I reviewed the article but i don't know how to make it work with angular.
Let say I login with admin and create tenant named "localhost:4201" and then re run the angular app with 4201 port. Then it should default load the "localhost:4201" tenant.
I tried set "localhost:4201" directly in domain resolver code(for testing only) as follows but it didn't worked.
Configure<AbpTenantResolveOptions>(options => { options.TenantResolvers.Insert(1, new DomainTenantResolveContributor("http://localhost:4201/")); });
Please help me understand the flow here.
Thanks.
-
0
For example:
Your application ur is
http://localhost:4200
, you wanthttp://tenant1.localhost:4200
to betenant1
.Config should be :
Configure<AbpTenantResolveOptions>(options => { options.TenantResolvers.Insert(1, new DomainTenantResolveContributor("{0}.localhost")); });
About multi-tenancy for Angular UI, you can refer https://github.com/abpframework/abp/blob/dev/docs/en/UI/Angular/Multi-Tenancy.md
-
0
Abp v3.04/MongoDb/Angular
I am trying to implement this without success. In the HttpApi.Host project I modify ConfigServices to include the domain resolver.
public override void ConfigureServices(ServiceConfigurationContext context) { var configuration = context.Services.GetConfiguration(); var hostingEnvironment = context.Services.GetHostingEnvironment(); Configure<AbpTenantResolveOptions>(options => { options.TenantResolvers.Insert(1, new DomainTenantResolveContributor("{0}.localhost")); }); ConfigureUrls(configuration); ConfigureConventionalControllers(); ConfigureAuthentication(context, configuration); ConfigureSwagger(context); ConfigureLocalization(); ConfigureVirtualFileSystem(context); ConfigureCors(context, configuration); }
In my Angular project I update the enviroment.ts file to inlciude a baseUrl.
export const environment = { production: false, application: { baseUrl: 'https://{0}.localhost/', name: 'Mmg', }, oAuthConfig: { issuer: 'https://localhost:44383', clientId: 'Mmg_App', dummyClientSecret: '1q2w3e*', scope: 'Mmg', showDebugInformation: true, oidc: false, requireHttps: true, }, apis: { default: { url: 'https://localhost:44383' }, }, localization: { defaultResourceName: 'Mmg', } };
http://localhost:4200/ will launch the application successfully. http://demo.localhost:4200/ returns status code 304 with a response of Invalid Host Header. Can you help shed some light on what I missed?
-
0
Sorry, I mean your HTTP API application url. About multi-tenancy for Angular UI, you can refer https://github.com/abpframework/abp/blob/dev/docs/en/UI/Angular/Multi-Tenancy.md
-
0
closed due to inactivity...