Page MenuHomePhabricator

MWExceptionRenderer : HTTP error code in case of DBConnectionError seems to be 200 instead of 503
Closed, ResolvedPublic

Description

In case of DB access error, Mediawiki 1.28 shows an html page defined in "includes/exception/MWExceptionRenderer.php".
In method "output", line 45 :

if ( $e instanceof DBConnectionError ) {
 self::reportOutageHTML( $e );
}

Actual Results: it seems the page is served with HTTP code 200 by default (checked with Firefox developer tool, Network tab). Our frontend (Varnish) also sees the page as a normal 200 response and starts caching the error pages.

Expected Results: serve the page with a 503 error code, maybe by adding a "self::statusHeader( 500 );" just before "self::reportOutageHTML( $e );", so frontends can detect the page is not the content they expect.

Details

Related Gerrit Patches:

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 20 2017, 12:09 AM
Reedy updated the task description. (Show Details)Mar 20 2017, 3:12 AM
Reedy added a project: Wikimedia-Rdbms.
Aklapper renamed this task from MWExceptionRenderer : HTTP error code in case of DBConnectionError to MWExceptionRenderer : HTTP error code in case of DBConnectionError seems to be 200 instead of 503.Mar 20 2017, 11:00 AM
Florian claimed this task.Apr 16 2017, 7:22 PM

Change 348396 had a related patch set uploaded (by Florianschmidtwelzow):
[mediawiki/core@master] Send 503 http status code, instead of 200, for DBConnectionErrors

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

Krinkle closed this task as Resolved.Apr 22 2017, 2:00 AM
Krinkle triaged this task as Normal priority.

Change 348396 merged by jenkins-bot:
[mediawiki/core@master] Send 500 http status code, instead of 200, for DBConnectionErrors

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