Bug #65801

Headers are visible if URI of pageNotFound_handling has a redirect by .haccess

Added by Stefan Froemken over 4 years ago. Updated 3 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2015-03-18
Due date:
% Done:

100%

TYPO3 Version:
6.2
PHP Version:
5.4
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

Hello,

in Installtool of domain1 we have configured:

[FE][pageNotFound_handling] = http://domain2/notFound.html

In Server with domain2 we have an .htaccess entry which redirects all calls to HTTP automatically to HTTPS
If you now try to show f.e. a Sysfolder in Frontend then a 404 page was shown, but on top you see a header like:

HTTP/1.1 200 OK Date: Mon, 16 Mar 2015 08:35:09 GMT Server: Apache Last-Modified: Tue, 26 Aug 2014 10:32:44 GMT Accept-Ranges: bytes Content-Length: 283 Cache-Control: max-age=1800 Expires: Mon, 16 Mar 2015 09:05:09 GMT Content-Type: text/html

If I change [FE][pageNotFound_handling] to an HTTPS uri everything works like excepted.

The problem appears in TypoScriptFrontendController->pageErrorHandler

$res = GeneralUtility::getUrl($code, 1, $headerArr);
// Header and content are separated by an empty line
list($header, $content) = explode(CRLF . CRLF, $res, 2);

Here is only a check for the first header data which is in our case the redirect. So the 200 OK Status Header was moved into the content area.

Stefan


Related issues

Related to TYPO3 Core - Bug #67136: Using pageNotFound handler with a cURL proxy can cause HTTP headers to be displayed Closed 2015-05-26 2016-09-30

History

#1 Updated by Simon Schaufelberger almost 2 years ago

Here is a snippet somebody sent to me. Maybe thats helpful.

$res = GeneralUtility::getUrl($code, 1, $headerArr);
// Header and content are separated by an empty line
list($header, $content) = explode(CRLF . CRLF, $res, 2);

if (substr($content, 0, 4) == 'HTTP') {
    list($header, $content) = explode(CRLF . CRLF, $content, 2);
}
$content .= CRLF;

#2 Updated by Riccardo De Contardi 3 months ago

Can this issue be considered still valid? If I have not understood it wrong, TypoScriptFrontendController->pageErrorHandler has been deprecated since version 9.2 and removed on 10

See

typo3/sysext/core/Documentation/Changelog/9.2/Deprecation-83883-PageNotFoundAndErrorHandlingInFrontend.rst

typo3/sysext/core/Documentation/Changelog/master/Breaking-87193-DeprecatedFunctionalityRemoved.rst

#3 Updated by Stefan Froemken 3 months ago

  • Status changed from New to Closed

You're right. With a redirect or static string in pageNotFound Handling of a TYPO3 8 to a non https URI, but with redirect to https, of a TYPO3 9 there are no header data visible anymore. Perfect. Ticket can be closed.

#4 Updated by Stefan Froemken 3 months ago

  • % Done changed from 0 to 100

Also available in: Atom PDF