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')));
Updated by Philipp Gampe over 12 years ago
Whoever does the fix, it would be good to have this covered by unit tests.
Updated by Mathias Schreiber almost 10 years ago
- Status changed from New to Needs Feedback
- Assignee set to Stefan Neufeind
- Is Regression set to No
could you check if the related issue is a dupe?
Thanks in advance
Updated by Stefan Neufeind about 9 years ago
Thanks. Closed the other as a dupe now.
Updated by Alexander Opitz about 9 years ago
- Status changed from Needs Feedback to New
Updated by Benni Mack almost 5 years ago
- Status changed from New to Needs Feedback
Hey Stefan,
we have several TYPO3 setups running with reverse proxies. However, I would say that this needs adaptions in the reverse proxy or FPM handler to correctly translates the paths according to your setup. Let me please know how to proceed, as TYPO3 internals work the way PHP hands in the information.
Updated by Georg Ringer over 4 years ago
- Status changed from Needs Feedback to Closed
Hey Stefan,
I am closing this issue because lack of feedback, feel free to open a new issue if still relevant or ping me to reopen it.