Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

david19's avatar

I need loadbalancer for this?

hello team, I have a laravel app with 2 languages. ​ www.domain.com/en www.domain.com/de ​ I like use a server in US for /en. And for /de a german server.

Is this the usecase of loadbalancer server??

0 likes
5 replies
jlrdw's avatar

Normally no, a load balancer is for heavy traffic. But you could still work out two servers if you want.

2 likes
david19's avatar

@jlrdw no? But which element tells laraval: This traffic come from germany, use the „de“ server? Because its the same domain. I dont like use subdomain.

jlrdw's avatar

@david19 if you aren't going to just use language files, you could probably set a default, then a link at top for which country.

Many sites I have seen have the Flags with country initials next to it.

I don't know if using ip addresses would work, as I have not dwelt with ip addresses in that way.

Edit:

From a search there are services for this, look here: https://stackoverflow.com/questions/60069319/country-name-from-ip-address

I suggest search further for more articles and post.

2 likes
david19's avatar

@jlrdw yes i understand what you mean. But how i configure this? Its the same laravel application, and the same domain. Do mean i setup in forge the „de“ server and set the domain in forge to domain.com/de? And on the other server domain.com/en?

Yes i have language switcher on the app. If you click „de“, then you will redirect to /de. And the session middleware locale change to de, too. This works! But now both use the same server.

Snapey's avatar

A service like Cloudflare can help you distribute traffic to two servers for as little as $5 per month

https://www.cloudflare.com/en-gb/load-balancing/

Im not sure it would also direct the user to a language specific url , you should probably do that in your app by choosing a default based on the user's location but also giving them a cookie if they decide to change language (eg, just because im travelling to the US wont necessarily mean i want the english version)

1 like

Please or to participate in this conversation.