Page MenuHomePhabricator

https://wikitech-static.wikimedia.org/wiki/ redirecting improperly
Closed, ResolvedPublic

Description

https://wikitech-static.wikimedia.org/wiki/ is returning a 301 redirect to https://wikitech.wikimedia.org/wiki/Main_Page. This feels like a configuration bug on wikitech-static. Directly visiting https://wikitech-static.wikimedia.org/wiki/Main_Page works as expected.

Event Timeline

Some notes from our work on figuring this out:

bd808 triaged this task as High priority.Jul 10 2020, 12:48 AM
bd808 moved this task from Inbox to Doing on the cloud-services-team (Kanban) board.

Setting $wgDebugRedirects = true; makes an HTML page appear, seems it's almost certainly not a apache config issue

<!DOCTYPE html>
<html>
<head>
<title>Redirect</title>
</head>
<body>
<p>Location: <a href="https://wikitech.wikimedia.org/wiki/Main_Page">https://wikitech.wikimedia.org/wiki/Main_Page</a></p>
</body>
</html>

mw.config.get('wgServer') on wikitech-static in a browser console shows a value of "https://wikitech.wikimedia.org", which seems wrong.

We did try changing that... I wonder if we didn't wait long enough for RL type caches to expire...

I don't think it's just RL. <link rel="EditURI"> tags in the page source are also pointing to wikitech.wikimedia.org.

I don't think it's just RL. <link rel="EditURI"> tags in the page source are also pointing to wikitech.wikimedia.org.

That's $wgServer related

I dunno what those variables are currently set to (I don't have shell on the box)

Andrew subscribed.

Now that @Reedy has access to the host I'm dumping this on him :D

I don't think it's just RL. <link rel="EditURI"> tags in the page source are also pointing to wikitech.wikimedia.org.

That's $wgServer related

I dunno what those variables are currently set to (I don't have shell on the box)

$wgServer = "https://wikitech-static.wikimedia.org";
$wgCanonicalServer = "https://wikitech-static.wikimedia.org";
$wgInternalServer = "https://wikitech-static.wikimedia.org";
root@wikitech-static:/srv/mediawiki/w# php maintenance/eval.php 
> echo $wgServer;
https://wikitech.wikimedia.org
> echo $wgCanonicalServer;
https://wikitech-static.wikimedia.org
> echo $wgInternalServer;
https://wikitech-static.wikimedia.org
>

So something seems to be overriding $wgServer along the way..

Ah. Just noticed in LocalSettings.php...

<?php

# Protect against web entry
if ( !defined( 'MEDIAWIKI' ) ) {
        exit;
}

require_once(__DIR__ . "/../config/Settings.php");

$wgSitenotice = "You are browsing a read-only backup copy of Wikitech. The primary site can be found at [https://wikitech.wikimedia.org wikitech.wikimedia.org]";
$wgServer = 'https://wikitech.wikimedia.org';

That $wgServer obviously overrides the one set in other files.

This should be fixed now... I think?

% curl -I https://wikitech-static.wikimedia.org/wiki/ | grep Location
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
Location: https://wikitech-static.wikimedia.org/wiki/Main_Page