Closed Bug 819047 Opened 12 years ago Closed 4 years ago

"en/" in a document slug triggers a redirects to "/en-US/"

Categories

(developer.mozilla.org Graveyard :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: sheppy, Unassigned)

References

Details

When someone puts "en/" in a locale, weird things happen. You get a page that directs you to the en-US/ locale for that page, instead of loading the page itself. Or something. See https://developer.mozilla.org/fr/docs/en/Using_files_from_web_applications for example.
This is due to legacy MindTouch URL redirection handling, found here:

https://github.com/mozilla/kuma/blob/master/apps/wiki/models.py#L1200

So, any wiki path that looks like "/{locale1}/docs/{locale2}/blah/blah" will get redirected to "/{locale2}/docs/blah/blah". 

That means any document that really has a recognized locale in its path will be inaccessible. We need some way to disable this redirection, maybe with a ?redirect=no parameter
Summary: When "en/" is used in a slug, things get weird → "en/" in a document slug triggers a redirects to "/en-US/"
I wonder how common this is.
We might be able to get an idea using Google analytics?
Flags: needinfo?(lcrouch)
tl;dr ~ 0.07% of requests are like this.

Hmm ... not in Google Analytics, no. GA requires a pageview to track, and 301 responses make the browser change locations before running any JS.

I didn't see this in New Relic either. We might get this data from New Relic when we upgrade our agent.

I even checked our old Graphite dashboard, but it's broken.

So, I grep'd the apache logs and came up with 85/113,004 = 0.07% of requests like this. Work shown here for extra credit:

[lcrouch@developer1.webapp.scl3 kuma]$ grep -rEn "/\w+/docs/en/" /var/log/httpd/developer.mozilla.org/access_2014-03-20-17 /var/log/httpd/developer.mozilla.org/access_2014-03-20-18 /var/log/httpd/developer.mozilla.org/access_2014-03-20-19 /var/log/httpd/developer.mozilla.org/access_2014-03-20-20 /var/log/httpd/developer.mozilla.org/access_2014-03-20-21 /var/log/httpd/developer.mozilla.org/access_2014-03-20-22 | wc -l
85

[lcrouch@developer1.webapp.scl3 kuma]$ wc -l /var/log/httpd/developer.mozilla.org/access_2014-03-20-17 /var/log/httpd/developer.mozilla.org/access_2014-03-20-18 /var/log/httpd/developer.mozilla.org/access_2014-03-20-19 /var/log/httpd/developer.mozilla.org/access_2014-03-20-20 /var/log/httpd/developer.mozilla.org/access_2014-03-20-21 /var/log/httpd/developer.mozilla.org/access_2014-03-20-22
   19585 /var/log/httpd/developer.mozilla.org/access_2014-03-20-17
   19133 /var/log/httpd/developer.mozilla.org/access_2014-03-20-18
   17764 /var/log/httpd/developer.mozilla.org/access_2014-03-20-19
   26141 /var/log/httpd/developer.mozilla.org/access_2014-03-20-20
   26751 /var/log/httpd/developer.mozilla.org/access_2014-03-20-21
    3630 /var/log/httpd/developer.mozilla.org/access_2014-03-20-22
  113004 total
Flags: needinfo?(lcrouch)
(In reply to Luke Crouch [:groovecoder] from comment #4)

> [lcrouch@developer1.webapp.scl3 kuma]$ grep -rEn "/\w+/docs/en/"

I think this grep misses the problematic cases for this bug. The issue isn't /docs/en, it's more like /fr/docs/foo/bar/en/baz/quux - the /en/ shows up somewhere in the middle and I think it triggers the redirect logic.
See Also: → 1245858
MDN Web Docs' bug reporting has now moved to GitHub. From now on, please file content bugs at https://github.com/mdn/sprints/issues/ and platform bugs at https://github.com/mdn/kuma/issues/.
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → WONTFIX
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.