roadrunner-server / roadrunner

🤯 High-performance PHP application server, process manager written in Go and powered with plugins
https://docs.roadrunner.dev
MIT License
7.86k stars 408 forks source link

PSR 7 Request is not compatible with HttpFoundationFactory #54

Closed shyim closed 5 years ago

shyim commented 5 years ago

Problem

I found a issue with the request uri. The PSR7 Request is created with 2 request URI's, we have it in the header with "REQUEST_URI" and in the $ctx['uri'] which will be given as uri to Request object.

The REQUEST_URI header seems to be every time the first called URL of the worker and the $ctx['uri'] the right URI.

The problem now is the Symfony HttpFoundationFactory writes the PSR7 Request URI as REQUEST_URI (https://github.com/symfony/psr-http-message-bridge/blob/master/Factory/HttpFoundationFactory.php#L42) but the wrong REQUEST_URI in the headers breaks it again to the first url. (https://github.com/symfony/psr-http-message-bridge/blob/master/Factory/HttpFoundationFactory.php#L48)

My Temporary Solution

After this line https://github.com/spiral/roadrunner/blob/master/src/PSR7Client.php#L76 to do

if (isset($_SERVER['REQUEST_URI'])) {
            unset($_SERVER['REQUEST_URI']);
}

This should be fixed in the Go part

shyim commented 5 years ago

Okay i found the issue :see_no_evil: . It was not the Request object, i will create a Pull request