Bug #38392
closedTYPO3_DOCUMENT_ROOT wrong if reverseProxyPrefix/reverseProxyPrefixSSL used
0%
Description
If reverseProxyPrefix or reverseProxyPrefixSSL is used an incorrect path for TYPO3_DOCUMENT_ROOT is generated in t3lib/class.t3lib_div.php (around line 4000).
The TYPO3_DOCUMENT_ROOT is determined by taking SCRIPT_FILENAME and removing SCRIPT_NAME from the end. That would work as expected if $_SERVER[...] or the like would be used. However self::getIndpEnv('SCRIPT_NAME') is used. And in case the call comes through a proxy that variable gets prepended reverseProxyPrefix or reverseProxyPrefixSSL. And thus the TYPO3_DOCUMENT_ROOT becomes wrong (points to the wrong directory, which usually doesn't exist!).
This has been in TYPO3 since at least 2010. But imho the ProxyPrefix-functionality is not that commonly used that many people might have noticed. And also not all/not many extensions use TYPO3_DOCUMENT_ROOT to access files imho.
Special-case we experienced: prefix being the last part of document-root.
URL with proxy: https://www.example.com/somehost.somewhere/xyz.php
URL internal : http://somehost.somewhere/index.php
filename on disk: /home/somebody/somehost.somewhere/index.php
TYPO3_DOCUMENT_ROOT then becomes: /home/somebody
(somehost.somewhere is stripped too much).
@Steffen: Imho itt seems you contributed the major part of this proxy-prefix-thing ...
c73d1301 (Steffen Kamper 2010-11-23 18:52:50 +0000 3508) $SN_A = explode('/', strrev(self::getIndpEnv('SCRIPT_NAME')));