How to modify the url with middleware? ReplacePath?

Hi all,

I'm not sure how to define a route which gets changed as it is forwarded into my webapp.

I've got the following endpoints with a webapp:

Route             forwards to an endpoint
-----------------------------
/users         -> /users
/users/*       -> /users/*
/users/swagger -> /swagger

I'm not sure how to use the docker labels to define these router values so it can get forwarded onto my webapp.

I'm doing all of this in a docker-compose file.

Here's what I was experimenting with:

version: '3.5'

services:
  users-api:
    image: spike.openapi/users.api
    build:
      context: ./
      dockerfile: src/Users/Dockerfile
    ports:
      - "80"
    networks:
      - backend
    container_name: users.api
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.users-api.rule=PathPrefix(`/users`)"
      - "traefik.http.routers.users-api.rule=Path(`/users/swagger`)"
      - "traefik.http.routers.users-api.entrypoints=web"

  reverse-proxy:
    image: traefik
    <snipped>

...

Can anyone please help?

I think you need a different router name for swagger, and then add a StripPrefix middleware.