You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(router-domains): add domain alias support for router domains
- Introduced an `alias` field for router domains to provide a stable, human-readable identifier.
- Updated API to accept `domainAlias` in route creation and updates, resolving it to `domainId`.
- Added validation to ensure unique aliases across router domains.
- Updated documentation to reflect changes in router domain configuration and usage.
- Modified tests to cover scenarios for creating and updating router domains with aliases.
See [Route metadata canonicalUrl](routing/route_configuration.md#canonicalurl) for more information.
181
180
182
181
### Client-side behavior
183
182
184
183
ILC automatically updates canonical tags during client-side navigation.
185
184
185
+
## Domain alias
186
+
187
+
The **alias** field provides a stable, human-readable identifier for a router domain. Unlike the auto-incremented numeric `id` or the `domainName` (which may differ between environments), the alias is a short slug that stays consistent across multiple ILC instances.
188
+
189
+
### Why it's needed
190
+
191
+
In setups with multiple ILC instances (e.g., staging and production, or multiple brands sharing route configuration), routes are often managed programmatically via the Registry API. Using the numeric `id` to reference a domain is fragile because IDs differ between instances. Using `domainName` is also fragile because the actual hostname may differ (e.g., `shop.example.com` in production vs. `shop.staging.example.com`).
192
+
193
+
An alias like `main-shop` can be identical across all instances, so a route payload referencing `domainAlias: "main-shop"` will bind correctly regardless of the instance it is applied to.
194
+
195
+
### Configure an alias
196
+
197
+
1. Open the ILC Registry and navigate to **Router domains**.
198
+
2. Select an existing domain or click **+ Create** to add a new one.
199
+
3. In the **Alias** field, enter a short identifier using only lowercase letters, digits, and hyphens (e.g., `main-shop`). Maximum 64 characters.
200
+
4. Click **Save**.
201
+
202
+
### Using `domainAlias` in routes
203
+
204
+
When creating or updating a route via the API, you can supply `domainAlias` instead of `domainId`. The two fields are mutually exclusive — provide exactly one or neither.
205
+
206
+
```json
207
+
{
208
+
"route": "/checkout",
209
+
"domainAlias": "main-shop",
210
+
"slots": { ... }
211
+
}
212
+
```
213
+
214
+
The Registry resolves the alias to the corresponding `domainId` at write time. If no router domain with that alias exists, the request is rejected with a validation error.
215
+
216
+
!!! note ""
217
+
The alias must be unique across all router domains within an ILC instance.
218
+
186
219
## Additional information
187
220
188
-
-ILC detects a domain from the [**request.host** of Fastify](https://www.fastify.io/docs/latest/Reference/Request/) and checks whether this hostname is listed in the **Router domains**.
189
-
-Each registered domain in the **Router domains** has its own set of routes that do not overlap.
190
-
-For routes, the domain is optional. If the request goes from the domain that is not listed in the **Router domains**, the routes for the request will stay unassigned.
221
+
- ILC detects a domain from the [**request.host** of Fastify](https://www.fastify.io/docs/latest/Reference/Request/) and checks whether this hostname is listed in the **Router domains**.
222
+
- Each registered domain in the **Router domains** has its own set of routes that do not overlap.
223
+
- For routes, the domain is optional. If the request goes from the domain that is not listed in the **Router domains**, the routes for the request will stay unassigned.
|`domainName`| Hostname of the domain (e.g. `example.com`). Used by ILC at runtime to match incoming requests. |
54
+
|`template500`| Default 500 error template for this domain. |
55
+
|`canonicalDomain`| Alternative domain used for canonical `<link>` tags. |
56
+
|`brandId`| Brand identifier for multi-brand setups. |
57
+
|`alias`| Stable human-readable slug (e.g. `main-shop`). Allows routes to reference this domain by alias instead of numeric ID, which is useful when synchronizing route configuration across multiple ILC instances where IDs may differ. |
58
+
|`props` / `ssrProps`| Domain-level properties merged into all applications running on this domain. |
0 commit comments