Project

General

Profile

Actions

Bug #38392

closed

TYPO3_DOCUMENT_ROOT wrong if reverseProxyPrefix/reverseProxyPrefixSSL used

Added by Stefan Neufeind over 12 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Must have
Category:
-
Target version:
-
Start date:
2012-06-26
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.5
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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')));


Related issues 1 (0 open1 closed)

Has duplicate TYPO3 Core - Bug #25266: allow redirect to ssl reverse proxyClosed2011-03-07

Actions
Actions #1

Updated by Philipp Gampe over 12 years ago

Whoever does the fix, it would be good to have this covered by unit tests.

Actions #2

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

Actions #3

Updated by Alexander Opitz over 9 years ago

ping

Actions #4

Updated by Stefan Neufeind about 9 years ago

Thanks. Closed the other as a dupe now.

Actions #5

Updated by Alexander Opitz about 9 years ago

  • Status changed from Needs Feedback to New
Actions #6

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.

Actions #7

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.

Actions

Also available in: Atom PDF