Language redirection not working on Chrome and Firefox (working on Safari)

Hey guys,

I am building a website with gatsby and hosting it on netlify. The website is available in two languages, french and english.
I want to redirect users from “/whatever” to either “/fr/whatever” or “/en/whatever” based on their browser language. I am using gatsby-plugin-netlify to create redirections using the following code:

createRedirect({
        fromPath: '/pricing/',
        toPath: '/fr/pricing/',
        statusCode: 302,
        Language: 'fr',
      });

This appends the following code to my _redirects file (which looks legit to me):

/pricing/  /fr/pricing/  302  Language=fr

Now when I navigate to my website on /pricing and my Chrome settings show french as my only language, I expect to be redirected to /fr/pricing. It is not working as expected, no redirection is happening. Same behavior with Firefox, but in Safari it’s working well, I am redirected to /fr/pricing.

Here is my instance (it’s a preview):
https://5dd57f7f4f94f10008fcdda1–angry-brahmagupta-89f699.netlify.com/

Hi @upflow. Welcome to netlify community!

Unfortunately, we have known issues around the odd behavior with language redirects that our team is looking in to. We do not have any workarounds at the moment. We’ll update here once we have more information.

Do you have an update for us? Need need to implement our own solution, if this is not soon resolved… Would be great if we wouldn’t have to. :slight_smile:

Best regard

Hi, @philschonholzer, and welcome to our Netlify community site.

The issues tracking this are still open. This forum topic is cross-linked with the open issues and we will post an update here if/when these issues are resolved. There is no official ETA of when this might occur though.

If there are other questions, we’ll be happy to answer.

4 years and still waiting for this feature that is “supported” according to the docs.
You could at least add a piece of documentation so people know it doesn’t work.

hey @valdo - i understand that its frustrating, and that’s not the experience we want you to have, of course.

Can you point me to the specific place in the docs you are referring to? Then, I can chat with them about it.

thanks again.

Hello. Here is the doc:

1 Like

Perhaps with edge handlers there is now a way to achieve the “fixed” feature
What do you think @perry ?

Hey! Given there’s no timeframe on our open launch of Edge Handlers, it’s worth keeping this topic around to discuss alternatives (and to critique the existing implementation, if so!)

In short, our language redirects can struggle with some browser’s implementation of language quality. For now, I’d use country redirects if they’re applicable else consider this: Language-based redirect only works when 1 browser language set - #19 by giorgos