@stof I updated the code (haven't pushed yet), but wanna some feedback from you. Here it is the method:

```php
    protected function createSubRequest($uri, Request $request)
    {
        $cookies = $request->cookies->all();
        $server = $request->server->all();

        // Override the arguments to emulate a sub-request.
        // Sub-request object will point to localhost as client ip and real client ip
        // will be included into trusted header for client ip
        try {
            $trustedHeaderName = Request::getTrustedHeaderName(Request::HEADER_CLIENT_IP);
            $oldXForwardedFor = $request->headers->get($trustedHeaderName, '');
            $newXForwardedFor = ($oldXForwardedFor ? $oldXForwardedFor . ', ' : '') . $request->getClientIp();

            $server['HTTP_' . $trustedHeaderName] = $newXForwardedFor;
        } catch (\InvalidArgumentException $e) {
            // Do nothing
        }

        $server['REMOTE_ADDR'] = '127.0.0.1';

        $subRequest = $request::create($uri, 'get', array(), $cookies, array(), $server);

        if ($session = $request->getSession()) {
            $subRequest->setSession($session);
        }

        return $subRequest;
    }
```