Page MenuHomePhabricator

Repair "svn.wikimedia.org/doc/" redirect for doc.wikimedia.org
Open, LowPublic

Description

Someone fixed the redirects.conf file so that svn.wikimedia.org/doc redirects to doc.wikimedia.org/mediawiki-core/master/php, because svn.wikimedia.org/doc no longer exists since a while.
https://phabricator.wikimedia.org/diffusion/OPUP/browse/production/modules/mediawiki/files/apache/sites/redirects.conf;46785c71c5eab2b987363e83ec2a6f26a6d6dea5$463

For https://svn.wikimedia.org/doc, this works.

However, https://svn.wikimedia.org/doc/ and https://svn.wikimedia.org/doc/classWikiPage.html, and anything that has a slash in it, remains broken.

RewriteRule ^/doc$ doesn't match anything except /doc. If it was "RewriteRule ^/doc/(.*)$, then it would. But is changing
override svn.wikimedia.org/doc https://doc.wikimedia.org/mediawiki-core/master/php/ -> override svn.wikimedia.org/doc/(.*) https://doc.wikimedia.org/mediawiki-core/master/php/ wanted behaviour? Would it cause issues?

Event Timeline

Southparkfan raised the priority of this task from to Needs Triage.
Southparkfan updated the task description. (Show Details)
Southparkfan added a subscriber: Southparkfan.
Dereckson added a project: User-Dereckson.
Dereckson added a subscriber: Dereckson.
Krinkle added a project: patch-welcome.
Krinkle added a subscriber: Krinkle.

Just fixed another one of these (edit). Looks like there are many more broken urls on mediawiki.org wiki pages,
https://www.mediawiki.org/w/index.php?title=Special:LinkSearch&limit=250&offset=0&target=http%3A%2F%2Fsvn.wikimedia.org%2Fdoc%2F

Probably many more broken urls on other wikis, in commit messages, other websites, and perhaps in less mutable publications/archivings.

Krinkle renamed this task from svn.wikimedia.org/doc/<any page> should redirect to doc.wikimedia.org to Repar "svn.wikimedia.org/doc/<any page> should redirect to doc.wikimedia.org.Nov 5 2019, 7:22 PM
Krinkle renamed this task from Repar "svn.wikimedia.org/doc/<any page> should redirect to doc.wikimedia.org to Repair "svn.wikimedia.org/doc/" redirect for doc.wikimedia.org.
Krinkle edited projects, added SRE; removed Wikimedia-Apache-configuration.
Krinkle added a subscriber: apaskulin.

I've asked about this on IRC. It seems to only take a 1 line change in Puppet to fix the redirect. But in 2013 when this task was filed there seems to have been some confusion about how override works. If this is still an issue, one may want to reach out via Scrum of Scrums that you are blocked on SRE to answer that concern.

Perhaps simplest to submit the change as written and handle the details in code review instead.

CCicalese_WMF added a subscriber: CCicalese_WMF.

Untagging Platform Engineering, since there is currently no work for the team to do on this.

Current status

svn.wikimedia.org/ redirects to https://phabricator.wikimedia.org/diffusion/
svn.wikimedia.org/doc/ redirects to https://doc.wikimedia.org/mediawiki-core/master/php/

The redirects are so like described in the task.

Proposal plan

The example given /doc/classWikiPage.html is rather trivial to fix, as the filenames didn't change:

https://doc.wikimedia.org/mediawiki-core/master/php/classWikiPage.html

So I guess the best plan is to redirect svn.wikimedia.org/doc(/.*) to https://doc.wikimedia.org/mediawiki-core/master/php$1

(and address during code review any override issue, if any, per Krinkle comment)

Actually, you can use the compiler of redirect.dat as a software to output to stdout the result:

ruby modules/mediawiki/lib/puppet/parser/functions/compile_redirects.rb modules/mediawiki/files/apache/sites/redirects/redirects.dat

Also, this language has rules to avoid to write and maintain regexp for trivial cases, like redirect a whole domain.

The current rules don't allow the more complex redirection where a PART of the original URL has to been taken.

The easiest is to provide more flexibility and allow to directly pass Apache/nginx regexp in redirects.dat for more complex cases.

I'm submitting a path with this approach, it provides the following redirect:

# regexp        svn.wikimedia.org/doc(/.*)      https://doc.wikimedia.org/mediawiki-core/master/php$1
RewriteCond %{HTTP_HOST} =svn.wikimedia.org
RewriteRule ^/doc(/.*)$ https://doc.wikimedia.org/mediawiki-core/master/php$1 [R=301,L,NE]

Change 631888 had a related patch set uploaded (by Dereckson; owner: Dereckson):
[operations/puppet@production] Redirect svn.wikimedia.org/doc properly

https://gerrit.wikimedia.org/r/631888