Page-based error handler

The page error handler displays the content of a page in case of a certain HTTP status. The content of this page is generated via a TYPO3-internal sub-request.

The page-based error handler is defined in EXT:core/Classes/Error/PageErrorHandler/PageContentErrorHandler.php (GitHub).

In order to prevent possible denial-of-service attacks when the page-based error handler is used with the cURL-based approach, the content of the error page is cached in the TYPO3 page cache. Any dynamic content on the error page (for example, content created by TypoScript or uncached plugins) will therefore also be cached.

If the error page contains dynamic content, TYPO3 administrators must ensure that no sensitive data (for example, username of logged-in frontend user) will be shown on the error page.

If dynamic content is required on the error page, it is recommended to implement a custom PHP based error handler.

FeatureFlag: subrequestPageErrors

Error pages (such as 404 - not found, or 403 - access denied) may be generated via a TYPO3-internal sub-request instead of an external HTTP request (cURL over Guzzle).

This feature is disabled by default, as there are some cases where stateful information is not correctly reset for the sub-request. It may be enabled on an experimental basis via a feature flag called subrequestPageErrors in the Admin Tools > Settings module.

Properties

The page-based error handler has the properties Properties and Properties and the following:

errorContentSource
type

string

Example

t3://page?uid=123

May be either an external URL or TYPO3 page that will be fetched with cURL and displayed in case of an error.

Examples

Internal error page

Show the internal page with uid 145 on all errors with HTML status code 404.

config/sites/<some_site>/config.yaml | typo3conf/sites/<some_site>/config.yaml
errorHandling:
  - errorCode: 404
    errorHandler: Page
    errorContentSource: 't3://page?uid=145'
Copied!

External error page

Shows an external page on all errors with a HTTP status code not defined otherwise.

config/sites/<some_site>/config.yaml | typo3conf/sites/<some_site>/config.yaml
errorHandling:
  - errorCode: 0
    errorHandler: Page
    errorContentSource: 'https://example.org/page-not-found'
Copied!