why not something like substr(..., strlen($request->getSchemeAndHttpHost()))
Seems more safe and reliable