[Improvement] Init: Introduce ErrorResponder (first usage: handle ilCtrl routing errors as HTTP 404)#11110
Open
fhelfer wants to merge 6 commits intoILIAS-eLearning:trunkfrom
Open
Conversation
…g errors as HTTP 404
ilCtrl routing errors as HTTP 404)
| } | ||
|
|
||
| if (!headers_sent()) { | ||
| http_response_code(StatusCode::HTTP_INTERNAL_SERVER_ERROR); |
Contributor
There was a problem hiding this comment.
The question is: Can we always assume that should result in an HTTP 502 status code?
components/ILIAS/Init/classes/ErrorHandling/ErrorPageResponder.php
Outdated
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ErrorController(ILIAS\Init\ErrorController) that renders error pages with proper HTTP status codes using the UI-Framework MessageBox, replacing duplicated error-rendering logic acrossilias.phpanderror.php.ilCtrlExceptionand anyThrowablewith "ilCtrl" in the message during request dispatching and responds with HTTP 404 instead of redirecting (which previously caused cascading requests and separate log files).error.phpto delegate page rendering to theErrorController(HTTP 500), keeping only the error.php-specific session cleanup in place.http_404_not_foundandhttp_500_internal_server_error(DE/EN).Motivation
ilCtrl-related exceptions are semantical routing/dispatching problems. Previously, these caused redirects toerror.phpor the ILIAS base URL in production, generating cascading requests and individual log files — unhelpful for administrators and monitoring. Requests causing these issues are often related to any kind of bots/client automation (AI, Search Engines, Hack Attempts). The additional I/O (the dedicated log file, if enabled, and the subsequent HTTP request) can also lead to performance issues on platforms with high traffic/many concurrent users.This change returns a clean HTTP 404 response directly, which is the correct semantic for "this route could not be resolved".
The changes also address the issue described in: https://mantis.ilias.de/view.php?id=45455