Locale Routing
What is Locale Routing?
Locale routing is the mechanism by which a storefront decides which URL, language, currency, and content variant to serve to each incoming request. In a composable, edge-rendered storefront it is one of the most consequential pieces of infrastructure, because it determines what every other layer — CMS, pricing, payments, search — has to localize against.
Definition
Locale routing typically encodes the locale into the URL path (/de/ch/produkt), a subdomain (de-ch.example.com), or a country-code top-level domain (example.ch). At request time, middleware on a CDN edge or in the framework resolves the effective locale from a precedence chain: explicit URL segment, persisted cookie, Accept-Language header, Geo-IP Detection, and finally a configured Locale Fallback. The resolved locale is then passed as context to downstream services via the Storefront API or directly to the rendering layer.
Why it matters
Bad locale routing is invisible until it breaks: a German shopper landing on an English homepage because of a stale cookie, or a Swiss visitor stuck in a redirect loop between /de/de/ and /de/ch/. Beyond UX, locale routing determines crawlability — search engines need stable, deterministic URLs per locale, complemented by Hreflang annotations. In a Composable-Commerce stack, the routing layer is often the first place where Personalization, A/B Testing, and Edge-Personalization converge, so it has to be both fast and explainable.
Use cases
A retailer running on a Jamstack frontend uses edge middleware to read the URL, parse /en/gb/checkout into { language: "en", region: "GB" }, and inject that into every CMS query and Storefront API call. A marketplace with a ccTLD Domain Strategy routes example.fr to the fr-FR locale and uses 308 redirects to keep crawlers tidy. A brand expanding into Belgium offers both nl-BE and fr-BE on the same domain and uses a locale switcher that updates the URL rather than a hidden cookie, so links remain shareable. For first-time visitors, Geo-IP Detection can suggest a locale, but the routing layer must respect explicit user choice afterwards to avoid the classic "trapped in the wrong country" experience.
Related
Explore Multi-Brand and Multi-Market.