Bug #91582

Fetching an internal page as 404 content breaks browser output and CDNs

Added by Markus Klein 8 months ago. Updated 4 months ago.

Status:
Closed
Priority:
Must have
Assignee:
Category:
Backend API
Target version:
-
Start date:
2020-06-04
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
10
PHP Version:
Tags:
Complexity:
hard
Is Regression:
Sprint Focus:

Description

Defining the error handling in the site configuration like this

errorHandling:
  - errorCode: '404'
    errorHandler: Page
    errorContentSource: 't3://page?uid=27'

causes a "connection failed" in Chromium based browsers. CDNs like Cloudflare even start repeating the request relatively fast (multiple times per second) ending in a 502 status code.

The problem drills down to the headers being received/sent when requesting the internal error page (27 above).
This request might deliver a "Transfer-Encoding: chunked" header.
Since the whole response of the sub-request is passed on as response to the initial request, also the headers from the sub-request are passed on.

This is may lead to problems, as the initial request may have another context than the internal sub-request.
In this case the "Transfer-Encoding" is not the same for the internal and the initial request. The actual webserver has to take care about settings this header correctly.

Fixing this issue, by removing this specific header from the sub-response, mitigates the problem and properly shows the 404 error page correctly, immediately and foremost without DoS-ing the server by the CDN.


Files

monitoring.jpg (103 KB) monitoring.jpg Relaxation of the server load after applying the patch Markus Klein, 2020-06-04 14:41

Related issues

Related to TYPO3 Core - Bug #81644: GeneralUtility::getUrl() socket method doesn't support chunked Content-EncodingClosed2017-06-21

Actions
Related to TYPO3 Core - Task #90956: Deprecate alternative fetch methods for GeneralUtility::getUrl()ClosedBenni Mack2020-04-05

Actions
#1

Updated by Markus Klein 8 months ago

  • Related to Bug #81644: GeneralUtility::getUrl() socket method doesn't support chunked Content-Encoding added
#2

Updated by Gerrit Code Review 8 months ago

  • Status changed from New to Under Review

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/64672

#3

Updated by Markus Klein 8 months ago

  • Status changed from Under Review to New
  • TYPO3 Version changed from 9 to 10
#4

Updated by Markus Klein 8 months ago

  • Status changed from New to Under Review
#5

Updated by Gerrit Code Review 8 months ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/64672

#6

Updated by Markus Klein 8 months ago

  • Related to Task #90956: Deprecate alternative fetch methods for GeneralUtility::getUrl() added
#7

Updated by Gerrit Code Review 8 months ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/64672

#8

Updated by Gerrit Code Review 8 months ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/64672

#9

Updated by Gerrit Code Review 8 months ago

Patch set 1 for branch 10.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/64852

#10

Updated by Markus Klein 8 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
#11

Updated by Benni Mack 4 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF