-
Notifications
You must be signed in to change notification settings - Fork 126
Request URI is incorrect when run under php-fpm/fastcgi #188
Description
When I moved my application from using the standard apache mod-php5 to one run by php-fpm (for performance reasons), I discovered that Tonic subsequently failed to correctly parse the request URI.
The getURIFromEnvironment() in Request.php first looks for $_SERVER['REDIRECT_URL'], and if that exists, uses it for the request URI.
This may be correct when run within apache, but under fpm, it returns the URL to the dispatch script instead.
eg:
Original request: http://localhost/myapp/web/category
In Apache:
$_SERVER['REDIRECT_URL''] is '/myapp/web/category'
In FPM:
$_SERVER['REDIRECT_URL''] is '/myapp/web/dispatch.php'.
I would recommend that Request.php check for $_SERVER["REQUEST_URI"] first instead of $_SERVER["REDIRECT_URL"], as it always seems to contain the correct URI that's needed.
I've hacked around this issue temporarily by overwriting $_SERVER["REDIRECT_URL"] with $_SERVER["REQUEST_URI"] in my dispatch.php, but having this handled in the base code would be great!