Traefik Ingress does not work for other paths

79 views Asked by At

I have a backend service which responds to / I run it on the ingress route myhost.com/client

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: {{ .Values.name }}-ingress
  namespace: kgys
  annotations:
    traefik.ingress.kubernetes.io/router.middlewares: {{ .Release.Namespace }}-{{ .Values.name }}@kubernetescrd
spec:
  tls:
  - hosts:
    - myhost.com
    secretName: tls-secret
  rules:
    - host: myhost.com
      http:
        paths:
        - path: /client
          pathType: Prefix
          backend:
            service:
              name: {{ .Values.name }}
              port:
                number: {{ .Values.ports.targetPort }}

---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  name: {{ .Values.name }}
  namespace: {{ .Release.Namespace }}
spec:
  stripPrefix:
    forceSlash: false
    prefixes:
      - /client

this is my middleware and ingress code, it works when I go to url "http://myhost.com/client/api/v1/openapi.json" but if try to go to "http://myhost.com/client/docs#" it fails to open that. It says

Failed to load API definition.

Errors
 
Fetch error
Not Found /api/v1/openapi.json

When I inspect through the browser I notice that "http://myhost.com/client/docs#" tries to reach "http://myhost.com/api/v1/openapi.json" which doesn't exist, it should reach "http://myhost.com/client/api/v1/openapi.json" I want to do this on kubernetes side, what should I do?

0

There are 0 answers