Bug #58494

Inifinite redirects if index.php presents in URI

Added by Rafael Kähm almost 6 years ago. Updated almost 6 years ago.

Status:
Needs Feedback
Priority:
Must have
Category:
MVC - Routing
Target version:
-
Start date:
2014-05-04
Due date:
% Done:

0%

PHP Version:
Has patch:
No
Complexity:

Description

TYPO3.Welcome package can show this issue.

If you have fresh TYPO3 Flow Setup and call http://...../index.php/flow/welcome(or http://...../index.php to) you'll be redirected to:

[04/May/2014:11:21:26 +0200] "GET /index.php HTTP/1.1" 303 115
[04/May/2014:11:21:26 +0200] "GET /index.php/flow/welcome HTTP/1.1" 303 130
[04/May/2014:11:21:27 +0200] "GET /index.php/flow/index.php/flow/welcome HTTP/1.1" 303 145
[04/May/2014:11:21:27 +0200] "GET /index.php/flow/index.php/flow/index.php/flow/welcome HTTP/1.1" 303 160
[04/May/2014:11:21:28 +0200] "GET /index.php/flow/index.php/flow/index.php/flow/index.php/flow/welcome HTTP/1.1" 303 175
[04/May/2014:11:21:28 +0200] "GET /index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/welcome HTTP/1.1" 303 190
[04/May/2014:11:21:28 +0200] "GET /index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/welcome HTTP/1.1" 303 205
[04/May/2014:11:21:29 +0200] "GET /index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/welcome HTTP/1.1" 303 220
[04/May/2014:11:21:29 +0200] "GET /index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/welcome HTTP/1.1" 303 235
[04/May/2014:11:21:29 +0200] "GET /index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/welcome HTTP/1.1" 303 250
[04/May/2014:11:21:30 +0200] "GET /index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/welcome HTTP/1.1" 303 265
[04/May/2014:11:21:30 +0200] "GET /index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/welcome HTTP/1.1" 303 280
[04/May/2014:11:21:30 +0200] "GET /index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/welcome HTTP/1.1" 303 295
[04/May/2014:11:21:30 +0200] "GET /index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/welcome HTTP/1.1" 303 310
[04/May/2014:11:21:31 +0200] "GET /index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/welcome HTTP/1.1" 303 325
[04/May/2014:11:21:31 +0200] "GET /index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/welcome HTTP/1.1" 303 340
[04/May/2014:11:21:31 +0200] "GET /index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/index.php/flow/welcome HTTP/1.1" 303 355

recursively.

NOTE: This infinite redirects makes not apache but TYPO3 Flow.
You can see that, if you add following line in TYPO3\Welcome\Controller\StandardController::redirectAction():

$this->systemLogger->log(sprintf('I\'m currently on "%s".', $_SERVER['REQUEST_URI']));

I use Apache 2.4 with mod_proxy_fcgi like http://wiki.apache.org/httpd/PHP-FPM shown.

History

#1 Updated by Rafael Kähm almost 6 years ago

I don't know currently if this is Apache's or PHP's fault but i'm sure that _SERVER["SCRIPT_NAME"] and _SERVER["PHP_SELF"] env are not set correctly if using FPM with mod_proxy_fcgi.

I'll check if there are some workarounds for this behaviour.

If somebody know how to fix this one, please post here.

#3 Updated by Rafael Kähm almost 6 years ago

So i found solution for this problem.

Best way to run FPM with Apache 2.4 (mod_proxy_fcgi) at all is here described: https://gist.github.com/RafaelKa/f17e1eafa740fd07eb3e
thanks to Andreas Bosch

#4 Updated by Bastian Waidelich almost 6 years ago

  • Status changed from New to Needs Feedback
  • Assignee set to Bastian Waidelich

Rafael Kähm wrote:

Hi Rafael,

thanks for reporting and the detailed description. So is this resolved or is https://gist.github.com/RafaelKa/29f5c5bcae902ef4740a still relevant?

#5 Updated by Rafael Kähm almost 6 years ago

Hello Bastian,

mod_proxy_fcgi does not set fcgi env properly and therefore Flow can not resolve SCRIPT_NAME properly. Hotfix https://gist.github.com/RafaelKa/29f5c5bcae902ef4740a#file-request-php-L444-L447 prevents infinite redirecting if using official Apache tutorial for running FPM.

With mod_proxy_handler you do not need hotfix described above, but i think many peaple will have same issue and we can merge this one in Flow master.

Also available in: Atom PDF