Project

General

Profile

Actions

Bug #20622

closed

ReverseProxy redirect

Added by Ulrich Fischer over 15 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
felogin
Target version:
-
Start date:
2009-06-16
Due date:
% Done:

0%

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

Description

t3lib_div::locationHeaderUrl uses t3lib_div::getIndpEnv('TYPO3_REQUEST_HOST') or t3lib_div::getIndpEnv('TYPO3_REQUEST_DIR') to get the full url. Is a reverse proxy used, the right variable would be HTTP_X_FORWARDED_HOST. The problem could be minimized, if the host in the url is replaced with the host of baseURL. baseURL is needed in other cases with this configuration to reach the home-page.

the critical line is:
header('Location: '.t3lib_div::locationHeaderUrl($this->redirectUrl));

A simple solution would be:
if(isset ($GLOBALS['TSFE']->baseUrl)){
$url = t3lib_div::locationHeaderUrl($this->redirectUrl);
$purl = parse_url($url);
$pHost = $purl['host'];
$baseurl = parse_url($GLOBALS['TSFE']->baseUrl);
$baseurlHost = $baseurl['host'];
$newUrl = str_replace ($pHost,$baseurlHost,$url);
header('Location: '.$newUrl);
} else {
header('Location: '.t3lib_div::locationHeaderUrl($this->redirectUrl));
}
(issue imported from #M11343)

Actions

Also available in: Atom PDF