Zone redirects fail for locales

RESOLVED FIXED

Status

developer.mozilla.org
Localization
--
major
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: Victor Bychek, Assigned: jwhitlock)

Tracking

(Blocks: 1 bug, {in-triage})

Details

(Whiteboard: [specification][type:bug][needsAutomation])

(Reporter)

Description

2 years ago
What did you do?
================
You should open main page of MDN and click links "Firefox" or "Firefox OS"

What happened?
==============
You'll get English version instead of choosen locale.

What should have happened?
==========================
You must get to translated version.

Is there anything else we should know?
======================================

Comment 1

2 years ago
Cannot reproduce, links are correctly generated with selected locale
Flags: needinfo?(a)

Comment 2

2 years ago
Ok seems the link generation is not the issue, there is a 302 response that redirects to generic en-US locale. Re-selecting the desired locale there does work but is arguably not desired.
Flags: needinfo?(a)

Comment 3

2 years ago
https://github.com/mozilla/kuma/blob/e1d3502acb07fd8a23ab920954f04c6715a908d0/kuma/landing/jinja2/landing/homepage.html#L84

wiki_url does a reverse django lookup
wiki_url('Firefox') => "{locale}/docs/Firefox"

This link is a redirect (as seen here: http://developer.mozilla.org/docs/Firefox$edit )

The content of said redirect contains a l10n code :

'''
<p>REDIRECT <a class="redirect" href="/en-US/docs/Mozilla/Firefox">Firefox</a></p>
'''

I have edited said redirect to not contain the /en-US but am not seeing any effect on my side.
https://developer.mozilla.org/en-US/docs/Firefox$compare?locale=en-US&to=1047234&from=376605
(Assignee)

Comment 4

2 years ago
This appears to be an issue with redirects to zones (pages outside of docs with some custom styling), and is not specific to ru:

* https://developer.mozilla.org/fr/docs/Firefox redirects to https://developer.mozilla.org/en-US/Firefox instead of https://developer.mozilla.org/fr/Firefox
* https://developer.mozilla.org/es/docs/Firefox redirects to https://developer.mozilla.org/en-US/Firefox instead of https://developer.mozilla.org/es/Firefox
* https://developer.mozilla.org/ru/docs/Firefox redirects to https://developer.mozilla.org/en-US/Firefox instead of https://developer.mozilla.org/ru/Firefox

Changing the landing page may improve the situation but not the underlying redirect issue.
Blocks: 1158239
Status: UNCONFIRMED → NEW
Ever confirmed: true
(Assignee)

Comment 5

2 years ago
:mbrandt - testing that this redirect goes to the proper locale may be a good integration test.

Updated

2 years ago
Whiteboard: [specification][type:bug] → [specification][type:bug][needsAutomation]
Severity: normal → major
Keywords: in-triage
Summary: Some links lead on wrong pages → Zone redirects fail for locales
(Assignee)

Updated

2 years ago
Assignee: nobody → jwhitlock
(Assignee)

Comment 6

2 years ago
Some results from further investigation:

1. The link goes to https://developer.mozilla.org/ru/docs/Firefox
2. which 301 redirects to https://developer.mozilla.org/docs/Mozilla/Firefox (HEAD gets 404)
3. which 301 redirects to https://developer.mozilla.org/en-US/docs/Mozilla/Firefox
4. which 302 redirects to https://developer.mozilla.org/en-US/Firefox

It appears the step 3 redirect is dependent on your language. If your ACCEPT_LANGUAGE heading says Russian is preferred, you will instead be redirected to the Russian namespace:

curl -vI -H "Accept-Language: ru" https://developer.mozilla.org/docs/Mozilla/Firefox

This may be why we are only now noticing this issue - many users are viewing the homepage in their preferred language already, and getting redirected correctly (if you can call 3 redirects in a row correct).

The fix seems to be that /ru/docs/Firefox should redirect to /ru/docs/Mozilla/Firefox, or even directly to /ru/Firefox. It appears to be a bad combination of auto-locales and zones, we'll see if it can be fixed cleanly.

Comment 7

2 years ago
Commits pushed to master at https://github.com/mozilla/kuma

https://github.com/mozilla/kuma/commit/47b8aaa388bef2c588c3ea48fb7a456d675df250
Fix bug 1267197 - update homepage.html & base.html

https://github.com/mozilla/kuma/commit/1c589411302e6231c5281684d7d8965f4caf0bbb
Merge pull request #3859 from mozilla/zone_moves_1267197_1270032

Bug 1267197 - Avoid redirects for zones
Bug 1270032 - Firefox OS -> B2G OS

Updated

2 years ago
Status: NEW → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → FIXED
(Assignee)

Comment 8

2 years ago
Reopening. Fixing the homepage and toolbar will help minimize the impact of the bug, but the interaction between zones and locale redirects still needs fixing.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
(In reply to John Whitlock [:jwhitlock] from comment #8)
> Reopening. Fixing the homepage and toolbar will help minimize the impact of
> the bug, but the interaction between zones and locale redirects still needs
> fixing.

Interaction between zones and locale redirects smell like bug 963943 to me.
Comment hidden (spam)
(Assignee)

Comment 11

2 years ago
Please don't use needinfo unless you... need info.
Flags: needinfo?(waxmigs2902)
(Assignee)

Updated

2 years ago
See Also: → bug 1154417, bug 963943
summery of quick review for paper cuts today: Jeff has done some research into this, so he's the one to talk to when you work on this. We'll spend as much as 2 dev days on this, but we'll leave it for the big zone purge, if it takes more time than that to fix.

Comment 13

2 years ago
Commits pushed to master at https://github.com/mozilla/kuma

https://github.com/mozilla/kuma/commit/b4b5f7d30442ca04f53b036b12990be52e03e3c0
fix bug 1267197 - Add a check for /docs/<zone> to DocumentZoneMiddleware

in situations where an extra '/docs/' was added to a url that is
directly to a zone root, do a permanent redirect to the url that
should have been used (/<locale>/<zone>).

https://github.com/mozilla/kuma/commit/199ce0d32353dfd1251429439e4329a69776d732
fix bug 1267197 - Add tests exercising requests combining locales with zone redirects

https://github.com/mozilla/kuma/commit/5daad4ef44713c66628bc06bb904d38fa292a4cc
fix bug 1267197 - Remove unnecessary handling of locale get param

This code is unreachable, due to the LocaleURLMiddleware.

https://github.com/mozilla/kuma/commit/9ab0ef764865215b224fdbbd09e54627f2b1c38d
Merge pull request #4001 from jbradberry/zone-redirects-1267197

bug 1267197: Change DocumentZoneMiddleware to deal with locale + zone redirects correctly

Updated

2 years ago
Status: REOPENED → RESOLVED
Last Resolved: 2 years ago2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.