Bug #20622
closedReverseProxy redirect
0%
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)
Updated by Martin Kutschker over 15 years ago
Please have a look at the TYPO3_CONF_VARS[SYS][reverseProxy*] configuration variables to see if that solves your problem.
Additionally have a look at your proxy's configuration. Many proxies can be configured to act transparently. The TYPO3 configurations mentioned above must be used when you cannot reconfigure the proxy.
Updated by Susanne Moog over 13 years ago
- Status changed from Needs Feedback to Closed
- Target version deleted (
0) - TYPO3 Version set to 4.4
Closed this bug because of no feedback for over a year.