async def METHOD_NAME(request: fastapi.Request, call_next):
    """
    This middleware tells ui when to clear its cache based on backend version changes.
    """
    ui_version = request.headers.get(
        mlrun.common.schemas.constants.HeaderNames.ui_version, ""
    )
    response: fastapi.Response = await call_next(request)
    development_version = config.version.startswith("0.0.0")
    # ask ui to reload cache if
    #  - ui sent a version
    #  - backend is not a development version
    #  - ui version is different from backend version
    # otherwise, do not ask ui to reload its cache as it will make each request to reload ui and clear cache
    if ui_version and not development_version and ui_version != config.version:
        # clear site cache
        response.headers["Clear-Site-Data"] = '"cache"'
        # tell ui to reload
        response.headers[
            mlrun.common.schemas.constants.HeaderNames.METHOD_NAME
        ] = "true"
    return response