redirectRegex doesn't work properly

Hi,

So I'm trying to turn this Nginx-ingress definition to a Traefik-ingress definition and It doesn't work properly. Nginx-ingress file uses regex for different paths. So I created middlewares in Traefik to simulate the behaviour but no luck. As an example, /swagger-ui/ path with traefik ingress will always redirect to /home.

I paste here both definitions in order to make it clear.

nginx-ingress definition:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: tb-ingress
  namespace: thingsboard
  annotations:
    nginx.ingress.kubernetes.io/use-regex: "true"
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
    nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
spec:
  rules:
    - http:
        paths:
          - path: /api/v1/integrations/.*
            pathType: ImplementationSpecific
            backend:
              service:
                name: tb-node
                port:
                  number: 8080
          - path: /api/v1/.*
            pathType: ImplementationSpecific
            backend:
              service:
                name: tb-http-transport
                port:
                  number: 8080
          - path: /api/.*
            pathType: ImplementationSpecific
            backend:
              service:
                name: tb-node
                port:
                  number: 8080
          - path: /swagger.*
            pathType: ImplementationSpecific
            backend:
              service:
                name: tb-node
                port:
                  number: 8080
          - path: /webjars.*
            pathType: ImplementationSpecific
            backend:
              service:
                name: tb-node
                port:
                  number: 8080
          - path: /v2/.*
            pathType: ImplementationSpecific
            backend:
              service:
                name: tb-node
                port:
                  number: 8080
          - path: /v3/.*
            pathType: ImplementationSpecific
            backend:
              service:
                name: tb-node
                port:
                  number: 8080
          - path: /static/rulenode/.*
            pathType: ImplementationSpecific
            backend:
              service:
                name: tb-node
                port:
                  number: 8080
          - path: /assets/help/.*/rulenode/.*
            pathType: ImplementationSpecific
            backend:
              service:
                name: tb-node
                port:
                  number: 8080
          - path: /oauth2/.*
            pathType: ImplementationSpecific
            backend:
              service:
                name: tb-node
                port:
                  number: 8080
          - path: /login/oauth2/.*
            pathType: ImplementationSpecific
            backend:
              service:
                name: tb-node
                port:
                  number: 8080
          - path: /
            pathType: ImplementationSpecific
            backend:
              service:
                name: tb-web-ui
                port:
                  number: 8080
          - path: /.*
            pathType: ImplementationSpecific
            backend:
              service:
                name: tb-web-ui
                port:
                  number: 8080

Traefik-ingress definition:

apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: thingsboard-ingressroute
  namespace: thingsboard
spec:
  entryPoints:
    - websecure
  routes:
    - kind: Rule
      match: Host(`thingsboard.example.com`) && PathPrefix(`/api/v1/integrations/(.*)`)
      services:
        - name: tb-node
          port: 8080
      middlewares:
        - name: stripprefix
        - name: test-redirectregex
    - kind: Rule
      match: Host(`thingsboard.example.com`) && PathPrefix(`/api`)
      services:
        - name: tb-node
          port: 8080
    - kind: Rule
      match: Host(`thingsboard.example.com`) && PathPrefix(`/api/(.*)`)
      services:
        - name: tb-node
          port: 8080
      middlewares:
        - name: test-redirectregex
    - kind: Rule
      match: Host(`thingsboard.example.com`) && PathPrefix(`/api/v1/(.*)`)
      services:
        - name: tb-http-transport
          port: 8080
      middlewares:
        - name: stripprefix
        - name: test-redirectregex
    - kind: Rule
      match: Host(`thingsboard.example.com`) && PathPrefix(`/swagger-ui`)
      services:
        - name: tb-node
          port: 8080
      middlewares:
        - name: test-redirectregex
    - kind: Rule
      match: Host(`thingsboard.example.com`) && PathPrefix(`/webjars(.*)`)
      services:
        - name: tb-node
          port: 8080
      middlewares:
        - name: test-redirectregex
    - kind: Rule
      match: Host(`thingsboard.example.com`) && PathPrefix(`/v2/(.*)`)
      services:
        - name: tb-node
          port: 8080
      middlewares:
        - name: test-redirectregex
    - kind: Rule
      match: Host(`thingsboard.example.com`) && PathPrefix(`/v3/(.*)`)
      services:
        - name: tb-node
          port: 8080
      middlewares:
        - name: test-redirectregex
    - kind: Rule
      match: Host(`thingsboard.example.com`) && PathPrefix(`/static/rulenode/(.*)`) #&& Headers(`Content-Type`, `application/javascript;charset=utf-8`)
      services:
        - name: tb-node
          port: 8080
      middlewares:
        - name: test-redirectregex
          #- name: autodetect
        - name: test-header
    - kind: Rule
      match: Host(`thingsboard.example.com`) && PathPrefix(`/assets/help/(.*)/rulenode/(.*)`)
      services:
        - name: tb-node
          port: 8080
      middlewares:
        - name: test-redirectregex
        - name: autodetect
    - kind: Rule
      match: Host(`thingsboard.example.com`) && PathPrefix(`/oauth2/(.*)`)
      services:
        - name: tb-node
          port: 8080
      middlewares:
        - name: test-redirectregex
    - kind: Rule
      match: Host(`thingsboard.example.com`) && PathPrefix(`/login/oauth2/(.*)`)
      services:
        - name: tb-node
          port: 8080
      middlewares:
        - name: test-redirectregex
    - kind: Rule
      match: Host(`thingsboard.example.com`) && PathPrefix(`/`)
      services:
        - name: tb-web-ui
          port: 8080
      middlewares:
        - name: autodetect
    - kind: Rule
      match: Host(`thingsboard.example.com`) && PathPrefix(`/(.*)`)
      services:
        - name: tb-web-ui
          port: 8080
      middlewares:
        - name: test-redirectregex
        - name: autodetect
  tls:
    secretName: thingsboard-ui-cert
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  name: stripprefix
spec:
  stripPrefixRegex:
    regex:
      - "/api/v1/.*"
    #- "/static/rulenode/.*" #// LEADS TO ERRORS IN RULECHAIN
      - "/api/v1/integrations.*"
      - "/index.html.*"
      #- "/static/.*" / LEADS TO ERRORS IN RULECHAIN
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  name: test-redirectregex
spec:
  redirectRegex:
    regex: ^https://thingsboard.example.com/(.*)
    replacement: https://thingsboard.example.com/${1}
    permanent: true
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  name: autodetect
spec:
  contentType:
    autoDetect: true
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  name: test-header
spec:
  headers:
     contentTypeNosniff: true

Has anyone any idea why it does the redirect?

P.S: Sorry for copying the whole config file.