Traefik reverse proxy routing outside of docker

I am running plex in docker with traefik reverse proxy. However, Plex's built-in search is very slow and unreliable. So I've made my own flask API in python. I would like to redirect any search queries from my plex container called fuzi0n-plex to my flask api. Plex search queries are routed through traefik reverse proxy at fuzi0n-plex.domain.com/hubs/search?query=test. I would like redirect such queries to my own api at http://127.0.0.1:5000/hubs/search?query=test. In this example it should pass all parameters to my api endpoint. How can I accomplish this in from my docker-compose.yml? I tried using the below configuration for my container but it didn't work. The requests still aren't hitting my api.

fuzi0n-plex:
        image: "plexinc/pms-docker:1.29.2.6364-6d72b0cf6"
        container_name: fuzi0n-plex
        logging:
          driver: "json-file"
          options:
            max-file: "5"
            max-size: "10m"
        restart: unless-stopped
        labels:
          - "traefik.enable=true"
          - "traefik.http.routers.fuzi0n-plex.rule=Host(`fuzi0n-plex.domain.com`)"
          - "traefik.http.routers.fuzi0n-plex.entrypoints=websecure"
          - "traefik.http.routers.fuzi0n-plex.tls.options=securetls@file"
          - "traefik.http.routers.fuzi0n-plex.tls.certresolver=cfdns"
          - "traefik.http.routers.fuzi0n-plex.middlewares=secureHeaders@file"
          - "traefik.http.services.fuzi0n-plex.loadbalancer.server.port=32400"
          - "traefik.docker.network=traefik_proxy"
          - "traefik.http.middlewares.plex-redirect.replacepathregex.regex=^/hubs/search"
          - "traefik.http.middlewares.plex-redirect.replacepathregex.replacement=/hubs/search"
          - "traefik.http.middlewares.plex-redirect.addprefix.prefix=http://127.0.0.1:5000"
          - "traefik.http.routers.plex-redirect.rule=Host(`fuzi0n-plex.domain.com`) && PathPrefix(`/hubs/search`)"
          - "traefik.http.routers.plex-redirect.middlewares=plex-redirect"
          - "traefik.http.routers.plex-redirect.entrypoints=websecure"
        volumes:
          - "/etc/localtime:/etc/localtime:ro"
          - "/dev/shm:/dev/shm"
          - "${APPDATA_ROOT}/fuzi0n-plex:/config"
          - "${APPDATA_ROOT}/fuzi0n-plex_db_backups:/backup"
          - "${APPDATA_ROOT}/fuzi0n-plex/transcode:/transcode"
          - "/mnt:/mnt"
        ports:
          - "127.0.0.1:32402:32400"
        environment:
          PUID: "${UID}"
          PGID: "${UID}"
          PLEX_UID: "${UID}"
          PLEX_GID: "${PGID}"
          VERSION: "plexpass"
          autoheal: "true"
          ADVERTISE_IP: "https://fuzi0n-plex.domain.com:443"
        devices:
          - "/dev/dri:/dev/dri"
        extra_hosts:
          - "analytics.plex.tv:127.0.0.1"
          - "metrics.plex.tv:127.0.0.1"

Did you get this working, I want to do something like this for Octoprint.