@@ -117,28 +117,46 @@ In addition to those fundamental modules, there are some share modules:
117117
118118### Configuration
119119
120- Angular solution contains src/assets/** appconfig.json** file which
121- contains some configuration for the client side:
120+ The Angular solution file src/assets/** appconfig.json** contains some
121+ configuration for the client side. At runtime, the client scripts will
122+ download this file, and use it to calculate the address of the server-side
123+ API:
122124
123- - ** remoteServiceBaseUrl** : Used to configure base address of the
125+ - ** remoteServiceBaseUrl** : Used to configure the base address of the
124126 server side APIs. Default value: http://localhost:22742
125- - ** appBaseUrl** : Used to configure base address of the client
127+ - ** appBaseUrl** : Used to configure the base address of the client
126128 application. Default value: http://localhost:4200
127129
128- ** appBaseUrl** is configured since we use it to define format of our
129- URL. If we want to use tenancy name as subdomain for a multi-tenant
130+ The purpose of ** appBaseUrl** is to enable the Angular client to decompose
131+ the browser address into tenant-name + base-url.
132+
133+ #### Subdomain Multi-Tenancy
134+
135+ If we want to use the tenancy name as a subdomain for a multi-tenant
130136application then we can define ** appBaseUrl** as
131137
132138http://** {TENANCY\_ NAME}** .mydomain.com
133139
134140{TENANCY\_ NAME} is the place holder here for tenant names. Tenancy name
135- can also be configured for ** remoteServiceBaseUrl** as similar. To make
136- tenancy name subdomains properly work, we should also make two
137- configurations beside the application:
141+ must be similarly configured for ** remoteServiceBaseUrl** .
142+
143+ It's important to understand that subdomain multi-tenancy is a function
144+ of the ` DomainTenantResolveContributor ` server-side class.
145+ This means that the server API ** must** be accessed via a sub-domain that
146+ conforms to the format you have defined during your configuration of
147+ AspNetBoilerplate (see
148+ [ Multi-Tenancy] ( https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/doc/WebSite/Multi-Tenancy.md#determining-current-tenant ) regarding preinitialization).
149+
150+ <img src =" images/angular2-core-subdomain-tenant-resolution-sequence.png " alt =" Angular ASP.NET Core Sub-Domain Tenancy Overview " class =" img-thumbnail " width =" 540 " height =" 379 " />
151+
152+ To complete the setup of subdomain tenancy, we should also make two
153+ infrastructural configurations:
138154
1391551 . We should configure DNS to redirect all subdomains to a static IP
140156 address. To declare 'all subdomains', we can use wildcard like
141- ** \* .mydomain.com** .
157+ ** \* .mydomain.com** . Note that if you have a split Angular/API
158+ setup, then you will need 2 subdomain formats, such as
159+ ** \* .app.mydomain.com** and ** \* .api.mydomain.com** .
1421602 . We should configure IIS to bind this static IP to our application.
143161
144162There may be other ways of doing it but this is the most simple way.
0 commit comments