Fix error when X-Forwarded-Path is not defined

This commit is contained in:
Pierre Rudloff 2020-10-19 22:20:19 +02:00
parent c5298dd24b
commit da93835ea2

View file

@ -35,7 +35,9 @@ class RouterPathMiddleware
*/
public function __invoke(Request $request, Response $response, callable $next)
{
$this->router->setBasePath(current($request->getHeader('X-Forwarded-Path')));
if ($path = current($request->getHeader('X-Forwarded-Path'))) {
$this->router->setBasePath($path);
}
return $next($request, $response);
}