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.

Event Timeline

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

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 triaged this task as Medium 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