Localization auto routing

We have two locales added to our localization setup. English UK and English USA.

We expect users visiting from the US to land on the en-us localized pages but this does not work. No matter what we try, users will always land on the primary UK locale. Is there anything I’m missing here?

We’ve tried with other languages like German (de) and tested with a german locale and it does route to the correct locale.

Is localization not able to handle this use case?

You should be able to do this with some custom code and an api that gets IP address! Here’s probably the most popular one https://www.ipify.org/

If you can’t code, use chatgpt to help! :slight_smile:

Hi Jules, what’s your published site link?
I’d like to check something. You can direct message me if you don’t want it in the forum.

I don’t know this for certain, but I suspect that Webflow’s localization routing is based on the language code only. Most English-user browsers are just configured for en, so when Webflow gets that, it seems to be deciding that the primary en-GB would work fine.

I want to try requesting a page in en-US specifically to see if it routes.

If not, I might adapt a localization routing lib that I wrote some years ago, but solving the geo detection issue would be most performant in a reverse proxy layer so that no additional requests or APIs are needed.

As Julian said, if you wanted to do this client-side only, you’d need to roll your own that combines language and geolocation to choose the optimal locale. Client side, you need a 3rd party API to do the GeoIP lookup and a few of them are pricey once you exceed the free plan limits.

I have a test here for some of the better known APIs you could use as a reference for the GeoIP lookup;

https://webflow-forms-demo.webflow.io/special/ip-info

Cloneable;