stripPrefix not working on 1.7 Traefik

Hello Team Traefik
I try to configure my traefik internal load balancer.

traefik:
enabled: true
imageTag: v1.7.20-alpine

service:
annotations:
cloud.google.com/load-balancer-type: Internal
beta.cloud.google.com/backend-config: '{"default": "tools-backend-config"}'

I have a url
https://tools.tech.XXX.cloud
my ingress gcloud LB --> traefik ingress --> grafana-svc-->grafana-pods.

OK it's seems to work fine when i use the url https://tools.tech.XXX.cloud/*

Now i need to add more /backend to this URL instead of having 1 certificat by ingress
grafana.tools.tech.XXX.cloud
project1.tools.tech.XXX.cloud
i would like to use one certificat for every service
URL: tools.tech.XXX.cloud/grafana /project1 /bar

apiVersion: v1
kind: ConfigMap
metadata:
  name: tools-traefik
  namespace: default
data:
  traefik.toml: |
    # traefik.toml
    debug = true
    defaultEntryPoints = ["http","https"]
    [entryPoints]
      [entryPoints.http]
      address = ":80"
      compress = true
        [entryPoints.http.redirect]
          regex = "^http://(.*)"
          replacement = "https://$1"
      [entryPoints.https]
      address = ":443"
      compress = true
        [entryPoints.https.tls]
          [[entryPoints.https.tls.certificates]]
          CertFile = "/ssl/tls.crt"
          KeyFile = "/ssl/tls.key"

    [http.routers]
      [http.routers.router1]
        service = "myService"
        middlewares = ["test"]
        rule = "Host(`tools.tech.XXX.cloud`)"

    [http.middlewares]
      [http.middlewares.test.stripPrefix]
        prefixes = ["/builder", "/bar", "/grafana"]
        forceSlash = false

and this my ingress in gke:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: traefik-tools-project-ingress
  namespace: default
  annotations:
    kubernetes.io/ingress.class: traefik
    #traefik.frontend.rule: "PathPrefixStrip:/builder;PathPrefix:/builder"
    #traefik.http.middlewares.test.redirectregex.regex: "^https://tools.XXX.cloud/builder/(.*)"
    #traefik.http.middlewares.test.redirectregex.replacement: "https://tools.XXX.cloud/$${1}"
    #traefik.http.middlewares.test-stripprefix.stripprefix.prefixes: "/bar,/builder"


#    traefik.frontend.rule.type: PathPrefixStrip
spec:
  rules:
    - host: tools.XXXX.cloud
      http:
        paths:
          - path: /grafana
            backend:
              serviceName: tools-grafana
              servicePort: 80
          - path: /bar
            backend:
              serviceName: web
              servicePort: 8080
          - path: /builder
            backend:
              serviceName: builder
              servicePort: 80

nothing work when i tape ://tools.tech.XXXX.cloud/builder/ or grafana/

do you have an idea ?

Hello,

These elements are Traefik v2 labels for Docker, they are not k8s annotations for Traefik v1.

https://docs.traefik.io/v1.7/configuration/backends/kubernetes/#annotations

Hi Idez Thks for your reply and your time .
I try the link below https://docs.traefik.io/v1.7/basics/#path-matcher-usage-guidelines
regarding the doc in v1.7. In my case if i want to forward traffic to grafana on path / i need to implemented this

apiVersion: extensions/v1beta1
metadata:
name: traefik-tools-project-ingress
namespace: default
annotations:
kubernetes.io/ingress.class: traefik
traefik.ingress.kubernetes.io/rule-type: "PathPrefixStrip /grafana/"

but i faced an issue in the logs traefik did i do something wrong ?

{"level":"error","msg":"Failed to get rule for ingress default/traefik-tools-project-ingress: cannot use non-matcher rule: "PathPrefixStrip /grafana/"","time":"2020-02-15T15:15:32Z"}

i have also try traefik.ingress.kubernetes.io/rule-type: "PathPrefixStrip" It work but my images cannot be loaded .

html
<img class="img-fluid link-image" src="/static/links-images/webapp.svg">

have to be .

html
<img class="img-fluid link-image" src="/grafana/static/links-images/webapp.svg">
in order to work ...

Do you have an idea ?

Hello For grafana i found the issue .

Tips
GF_SERVER_ROOT_URL: "%(protocol)s://%(domain)s:%(http_port)s/grafana"

but for the other apps i stuck with traefik . Traefik path based routing in kubernetes ingress not working as expected . I don't understand why i haved to change the Url backend for using reverse proxy . Traefik cannot be queried to build such URLs dynamically it's simplement inconceivable while nginx can do the staff with rewrite url .....