Page MenuHomePhabricator

Special:WhatLinksHere should not return 404 status when no results are found
Open, Needs TriagePublic


The use of the 404 Not Found error should be reserved for when the page itself cannot be found. When Special:WhatLinksHere returns 0 results, the page is operating exactly the same as if it returned 1 or more results. It should be returning a 200 OK status, as the page is working just fine.

Event Timeline

Thanks, @Reedy.

It seems similar behavior was also questioned in T212702: Special:RecentChangesLinked returns 404, which was closed as invalid with the recommendation being:

For anyone wanting to change this behaviour, I recommend going back to the original ticket and evaluating if it is still an issue and whether is can be solved differently.

I think the closure of that issue was incorrect, because the initial issue and its fix were overzealous: The issue was that bots were linking to non-existent pages, and then the special pages were trying to query against non-existent pages. However, that is not the same thing as returning 0 results for a valid page.

I think the behavior introduced in rMW8b356fda61f1: Send 404 in various special pages when there're no results should be changed such that only the (non-)existence of the base page determines the 404 status. If the base page exists but the search query returns 0 results, a 404 status should not be used.