'Setting up ingress to handle forwarding part of path to service

Long story short - i do not even know how to google it so here i am asking question here:

I want ingress to pass to pod only part of a path it recieves from end user in such manner:

request goes on address www.example.com/svc-prefix/path/to/resource, and to pod i want only example-svc.example-ns/path/to/resource/ to be passed to pod so basically i'd like this "/base/" part to be omitted.

That indicates that nginx.ingress.kubernetes.io/rewrite-target: /$2 is not an option here since www.example.com/path/to/resource is already served by another service.

Example ingress resource:

kind: Ingress
metadata:
  annotations:
    meta.helm.sh/release-name: example-svc
    meta.helm.sh/release-namespace: example-ns
  generation: 1
  name: example-svc
  namespace: example-ns
spec:
  ingressClassName: internal
  rules:
  - host: www.example.com
    http:
      paths:
      - backend:
          serviceName: example-svc
          servicePort: http
        path: /base
        pathType: ImplementationSpecific

As i said I do not even know how to formulate this as a proper question, so if somebody even nudges me with proper keyword or documentation reference i'd be gracious.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source