Search code examples
google-cloud-platformgoogle-cloud-storagegoogle-cloud-load-balancer

Google Cloud load balancer redirect if from a certain region


I have two static pages (English, Danish) which are currently in Google Cloud Storage Bucket. This bucket contains en and dk folders for those static pages. Also, I have a Load Balancer with Google CDN feature.

I want to achieve that when a person connects to the website from Denmark, that person would get the Danish static page. Meanwhile, people outside Denmark would receive the English site.

How can I achieve this goal in the load balancer level?

P.s. I think it can be done with forwardingRules but I couldn’t figure out how the rules should look like.


Solution

  • I did some research and I think that your needs could be solved with a LB using the header-based routing, using the Accept-Language vary as the routeRules for the URL query. This guide can help you to achieve this configuration, but you need to adapt it to be ruled by the Accept-Language header parameters that could be more useful for your case.