Language-based redirect only works when 1 browser language set

I noticed language-based redirects aren’t working of the browser has two languages configured.

I have a redirect rule in my _redirects file as follows:

/  /jp   302  Language=ja

I have set my browser to Japanese with English (US) as my secondary language. My browser (Chrome) sends the following request header.

accept-language: ja,en-US;q=0.9,en;q=0.8

This does not redirect the site.

If I change my browser to Japanese only it sends the following header:

accept-language: ja

When I retry it redirects fine. I have no specific rules set up for English, which is why I’m surprised the redirect doesn’t work. I’m pretty sure this used to work. Can someone clarify?

5 Likes

Hi, @cbetta_box, welcome to our community site. As I believe you may already be aware (via other communication outside of this community thread), this is a known issue we are tracking at this time.

We’ll update this ticket if/when those issues are known to be resolved (and we’ll also email you directly relating to the other communication channel as well).

Any updates on this issue? We use Netlify as our main redirect system.

The response I received via email was that this was a known issue that is in the process of receiving a wider rewrite that might take till Q2 next year. Not ideal, but excited for the improvements.

@jesse-deboer, I don’t have an official ETA of if/when this issue will be resolved.

Sorry to ping, but any updates here? Or ideas for a temporary workaround when the browser sends multiple languages?

Hey oskar, no problem at all. This issue is a sub-concern of something that needs some more comprehensive architectural changes, so we are moving forward with care! We need a little more time to test our changes at scale - we haven’t forgotten about it, and we’ll update here once there is more specific news to share. thanks for your patience. :pray:

1 Like

Sorry to ping again, but…any update about this? It’s still failing at least for our projects.

no, i’m sorry that it’s still not working as you’d like it to! I can share that we are very carefully testing some larger infra changes that will likely also fix this issue - no firm eta yet, but we are getting closer. Sorry it is taking us so long!

1 Like

any update about this? we have a lot of problems width this…

hi existo, i responded to you here:

Thanks for your reply.

Everything is described in this topic:

Yes, so, as Perry said on 2 July, no status change as yet. We will follow up here when there is one - we are as anxious as you are and will not forget this thread :slight_smile:

Hello,

Any update about this? We are struggling to implement reliable redirects based on language or country

Best regards,
Paul

Hey Paul,

Country redirects should be swimming with their head well above water. If you’re having issues specifically with these, please create a topic.

As for language redirects… we mean it when we say we’ll be sure to feed back once there’s developments! :smiley:

We implemented a solution based on netlify’s functions that works with Accept-Language with multiple locales and quality.

https://github.com/mozmeao/pocket-marketing-pages/blob/master/functions/redirect.js

We had to hook the function to /redirect/* because using /* was causing a infinite redirect loop in our case.

Hope this proves useful for other folks!

thank you for sharing!!

Any update on this getting fixed. This basically makes Language redirection worthless. Also this appears to have been an issue since 2019…

Hi @jclusso,

Sorry to say, but the issue is still relevant at the moment.

I don’t see how you could ever get something like this to work if you want EN to be at the root and other langes to be in subdirectories.