MediaWiki generally treats redirect chains longer than 1 as invalid. That is, only direct redirects are valid, indirect ones are invalid and not followed.
Steps to reproduce:
- A wiki page "C" exists with some content.
- A wiki page "B" redirects to "C".
- A wiki page "A" redirects to "B" (it does not matter in which order you create these. Each page is independent and stateless).
- Request A from the REST API, e.g. example.org/w/rest.php/v1/page/A/with_html
Other information
When you visit C normally in the browser (eg. example.org/wiki/C), you get the content of C.
When you visit B (eg. example.org/wiki/B), you get the content of C, with a note that we followed a redirect from B.
When you visit A (eg. example.org/wiki/A), you receive a placeholder page indicating that "A" is a redirect to B, but the redirect is not followed (because it is invalid, because chains longer than 1 are not valid).
The REST API represents wiki-style redirects as native HTTP redirects. This "native" HTTP redirecting is different from how MediaWiki pageviews and the MediaWiki Action API work, which is to respond with the destination and a JSON or other header indicating that we normalized and/or redirected the title. This native HTTP format, combined with a lack some sort of lookahead validation, means that A>B>C actually works. What that could be an interesting feature in the future, this is currently inconsisistent with the rest of MediaWiki and thus unexpected.
Actual:
A redirect response with HTTP 30x and a Location header to B.
Expected:
A JSON response that represents the page "A" indicating that is a redirect (but not followed).