How to block certain URI/ HTTP path?

I'm using Traefik v2 as an Ingress controller, and I have a redirection rule for the root path "/"

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: sonic-gateway
  labels:
    app.kubernetes.io/instance: sonic
  annotations:
    kubernetes.io/ingress.class: traefik
    traefik.ingress.kubernetes.io/router.entrypoints: websecure
    traefik.ingress.kubernetes.io/router.tls: "true"
spec:
  tls:
    - hosts:
      secretName: domain-secret
  rules:
    - host: "sonic.demo"
      http:
        paths:
          - path: /
            backend:
              serviceName: sonic-gateway
              servicePort: http

How can I manage the situation when I do not want to make paths like "/api" or "/user/help" accessible from the internet?

Hi @disparo13
Were you able to solve this? I too have the same requirement and currently using v2.6.
One workaround I found is to use ReplacePathRegex middleware and permanently redirect sensitive URLs to other page.

Hi @kmskpraveen,

Using Traefik v2.9.1 I've utilized the Path matchers support for inversion (~ negation), in-order to limit access to certain endpoints.
The result is a 404 response :nerd_face: