Netlify Geo Routing lets you serve different content to visitors based on their geographic location, but it’s not just about showing them a different page; it’s about redirecting them to a completely separate, pre-built site that’s optimized for their region.
Let’s see it in action. Imagine you have three Netlify sites: my-awesome-app-us.netlify.app, my-awesome-app-de.netlify.app, and my-awesome-app-jp.netlify.app. You want US visitors to land on the US site, German visitors on the DE site, and Japanese visitors on the JP site.
Here’s how you’d configure it in your Netlify dashboard:
-
Navigate to your "main" Netlify site. This is the site that will own the Geo Routing configuration. Let’s call it
my-awesome-app.netlify.app. This site doesn’t need to serve any content itself; its sole purpose is to handle the geo-routing logic. -
Go to "Site settings" > "Build & deploy" > "Geo-routing".
-
Click "Configure Geo-routing".
-
Add rules:
- Rule 1 (US):
- Country: United States
- Redirect to:
https://my-awesome-app-us.netlify.app - Status code: 302 (Found) - This is a temporary redirect, suitable for most geo-routing scenarios.
- Rule 2 (Germany):
- Country: Germany
- Redirect to:
https://my-awesome-app-de.netlify.app - Status code: 302 (Found)
- Rule 3 (Japan):
- Country: Japan
- Redirect to:
https://my-awesome-app-jp.netlify.app - Status code: 302 (Found)
- Rule 1 (US):
-
Set a default redirect:
- Default redirect:
https://my-awesome-app-us.netlify.app - Status code: 302 (Found)
- Default redirect:
Once saved, if a visitor from California accesses my-awesome-app.netlify.app, Netlify’s edge network will detect their IP address, determine they are in the US, and issue a 302 Found redirect to https://my-awesome-app-us.netlify.app. If they are from Berlin, they’ll be redirected to https://my-awesome-app-de.netlify.app. Anyone else, or if the location can’t be determined, will be sent to the default (in this case, the US site).
The core problem Geo Routing solves is delivering a localized and performant experience without resorting to complex client-side JavaScript or server-side logic on a single monolithic application. Each regional site can be independently deployed, optimized, and even run on different frameworks or have specific content tailored for that market (e.g., different pricing, language, or product offerings). Netlify’s edge network handles the initial IP lookup and redirection before the user’s browser even requests content from the target site. This means the latency is minimal, and the user is immediately directed to the most appropriate version of your application.
Internally, Netlify uses a combination of IP geolocation databases and its distributed edge network. When a request hits a Netlify edge server, it looks up the visitor’s IP address against its geo-database. Based on the country (and potentially region/city, though Netlify’s primary geo-routing is country-based), it then applies the configured rules. The rules are essentially a series of 301 (Permanent) or 302 (Found) HTTP redirects. You choose the status code based on whether you want search engines to permanently associate the original URL with the regional URL (301) or treat it as a temporary move (302). For Geo Routing, 302 is generally preferred because the "main" URL is still the canonical one, and the regional sites are dynamic targets.
The "Default redirect" is crucial. It acts as a fallback for any visitor whose location isn’t explicitly defined in your rules, or if the geolocation lookup fails. This ensures that no visitor lands on a broken or unhandled page. The order of your rules does not matter because Netlify matches based on the specific country you define. It’s not a sequential matching process like a typical firewall rule set; it’s a direct lookup.
What most people don’t realize is that the "main" site you configure Geo Routing on doesn’t actually need to serve any content at all. You can deploy an empty HTML file with a simple index.html that just contains <meta http-equiv="refresh" content="0; url=/"> or even an empty _redirects file. Netlify’s build process will still recognize the Geo-routing configuration, and the edge network will correctly handle the redirects. The "main" site’s build and deploy is effectively a placeholder for the configuration itself.
The next step after implementing Geo Routing is often managing the content and deployment pipelines for each individual regional site, ensuring they are updated in sync or independently as needed.