Page MenuHomePhabricator

WikimediaDebug makes api.wikimedia.org always 301 redirect
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

What happens?:

The first load should show some JSON.

The second load will 301 redirect to https://www.mediawiki.org/wiki/Wikimedia_APIs

Further loads of that URL will have the 301 cached for about an hour.

What should have happened instead?:

No redirect should happen.

Event Timeline

I discovered this while backporting a change to a EditCheck that had to access an API hosted on api.wikimedia.org, which seems to be fundamentally untestable on the testservers as a result of this behavior.

Clement_Goubert triaged this task as Medium priority.EditedJun 30 2026, 9:38 AM
Clement_Goubert subscribed.

The reason that happens is the X-Wikimedia-Debug header (or the extension which just sets that header) bypasses ATS at the edge where the routing to the rest gateway for api.wikimedia.org API endpoints is done. It forces you to the mw-debug MediaWiki-On-Kubernetes deployment, which redirects everything under api.wikimedia.org to the API Doc page.

The caching behaviour you mention is your browser cache.

We have a pending task for this, T428909: Investigate X-Wikimedia-Debug routing for api.wikimedia.org, but I will try to figure out a quick workaround for api.wikimedia.org.

Change #1306643 had a related patch set uploaded (by Clément Goubert; author: Clément Goubert):

[operations/puppet@production] trafficserver::backend: Remove X-W-D for api.w.o

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

Change #1306643 merged by Clément Goubert:

[operations/puppet@production] trafficserver::backend: Remove X-W-D for api.w.o

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

Clement_Goubert claimed this task.

This should now be fixed for this use case, general discussion continues in parent. Feel free to reopen if issues persist.