def METHOD_NAME(request: web.Request) -> Callable:
    app = request.app
    def _url_for(route_name: str, **params: dict[str, Any]) -> str:
        """Reverse URL constructing using named resources"""
        try:
            rel_url: URL = app.router[route_name].url_for(
                **{k: f"{v}" for k, v in params.items()}
            )
            url: URL = (
                request.url.origin()
                .with_scheme(
                    # Custom header by traefik. See labels in docker-compose as:
                    # - traefik.http.middlewares.${SWARM_STACK_NAME_NO_HYPHEN}_sslheader.headers.customrequestheaders.X-Forwarded-Proto=http
                    request.headers.get(X_FORWARDED_PROTO, request.url.scheme)
                )
                .with_path(str(rel_url))
            )
            return f"{url}"
        except KeyError as err:
            raise RuntimeError(
                f"Cannot find URL because there is no resource registered as {route_name=}"
                "Check name spelling or whether the router was not registered"
            ) from err
    return _url_for