Problem/Motivation
When there's a problem with the site, it simply prints
The website encountered an unexpected error. Try again later.
.
However, HTTP error code 200 is still being returned, which means everything is okay.
This is problematic because:
- it's incorrect, and
- monitoring services rely on non-200 error codes to issue alerts so admins won't know that there's a problem.
Steps to reproduce
Set your DB to read-only, and hit a page in Drupal that needs to write to it.
Proposed resolution
Return a more logical error code, like 500 (but suggestions welcome).
Remaining tasks
TBD
User interface changes
None.
Introduced terminology
None.
API changes
Maybe. Depends on whether anything depends on these returning 200 when they shouldn't.
Data model changes
Hopefully none.
Release notes snippet
TBD
Comments
Comment #2
danielvezaI can only see two references to
The website encountered an unexpected error. Try again later.in cores codebase.FinalExceptionSubscriber&errors.inc. Both places set the status code to 500 and there is test coverage for this.Could there be a contrib module or custom code that is interferring here?
I tested this by throwing exceptions in the code, and introducing syntax errors. Both returned 500s in the browser
Comment #3
cilefen commentedThis could be another duplicate of #2688999: Default all responses to 500 before any code is run so PHP will throw 500's on FATAL errors.
Comment #4
colanWorks for me! I couldn't find anything like that earlier. Thanks y'all for looking into it.