                             return Response(status: .badRequest)
                         }
 
-                        let requestPathComponents = router.splitPathIntoComponents(path)
+                        let requestPathComponents = path.split(separator: "/")
                         let shortenedRequestPathComponents = requestPathComponents.dropFirst(prefixPathComponentsCount)
-                        let shortenedPath = router.mergePathComponents(Array(shortenedRequestPathComponents))
+                        let shortenedPath = "/" + shortenedRequestPathComponents.joined(separator: "/")
 
                         request.uri.path = shortenedPath
                         return try router.respond(to: request)

    }
}

extension Router {
    public func splitPathIntoComponents(_ path: String) -> [String] {
        return path.split(separator: "/")
    }

    public func mergePathComponents(_ components: [String]) -> String {
        return "/" + components.joined(separator: "/")
    }
}


}

extension RouterBuilder {
    public func compose(_ path: String = "", middleware: Middleware..., router: HTTP.Router) {
        let prefix = self.path + path

        let prefixPathComponentsCount = prefix.split(separator: "/").count

        for route in router.routes {
            for (method, _) in route.actions {
