apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
  name: stripprefix
  namespace: default

spec:
  stripPrefix:
    prefixes:
      - /tobestripped

---
apiVersion: traefik.io/v1alpha1
kind: TraefikService
metadata:
  name: test-weighted
  namespace: default

spec:
  weighted:
    services:
      - name: whoami
        port: 80
        weight: 1
        middlewares:
          - name: stripprefix

---
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
  name: test.route
  namespace: default

spec:
  entryPoints:
    - web

  routes:
    - match: Host(`foo.com`) && PathPrefix(`/bar`)
      kind: Rule
      priority: 12
      services:
        - name: test-weighted
          kind: TraefikService