@@ -117,28 +117,46 @@ In addition to those fundamental modules, there are some share modules:
117
117
118
118
### Configuration
119
119
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:
122
124
123
- - ** remoteServiceBaseUrl** : Used to configure base address of the
125
+ - ** remoteServiceBaseUrl** : Used to configure the base address of the
124
126
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
126
128
application. Default value: http://localhost:4200
127
129
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
130
136
application then we can define ** appBaseUrl** as
131
137
132
138
http://** {TENANCY\_ NAME}** .mydomain.com
133
139
134
140
{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:
138
154
139
155
1 . We should configure DNS to redirect all subdomains to a static IP
140
156
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** .
142
160
2 . We should configure IIS to bind this static IP to our application.
143
161
144
162
There may be other ways of doing it but this is the most simple way.
0 commit comments