cnu
cnu

Reputation: 531

Traefik 2.x IngressRoute not working with given web application context root

We're using TraefikEE 2.x Ingress Controller and my SpringBoot based web application runs at port 8080 with context root /myapp. I have below IngressRout defined but getting 404 error when going to http://example.com/myapp or http://example.com/myapp/. The same IngressRoute definition works if I remove /myapp context root from the application configuration, so that application pages load with / as context path.

apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: myapp
spec:
  tls: {}

  entryPoints:
    - websecure
  routes:
    - match: PathPrefix(`/myapp`)
      kind: Rule
      services:
        - name: myapp-service
          namespace: default
          port: 8080

Upvotes: 1

Views: 3723

Answers (1)

cnu
cnu

Reputation: 531

Found out hard way that I had more than one IngressRoutes for above application/service in different namespaces, one in default namespace and the other in application specific namespace. Deleted the entry from the default namespace and added namespace scope to the YAML so that we don't have to use -n option while applying the changes. The IngressRoute is now working fine.

apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
  metadata:
  name: myapp
  namespace: myapp
spec:
  tls: {}
  entryPoints:
    - websecure
  routes:
    - match: PathPrefix(`/myapp`)
      kind: Rule
      services:
        - name: myapp-service
          namespace: myapp
          port: 8080

Upvotes: 2

Related Questions