How do I configure my IngressRoute to route to different services based on the path? For example, if my app is on myapp-ui.example.org
and I want all requests on the root (/
or myapp-ui.example.org/
) to go to one service and all requests that go to /api
(or myapp-ui.example.org/api/
), how do I define the rules in the IngressRoute?
So far, I have something like this but it does not seem to work:
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: frontend-ingress
spec:
entryPoints:
- web
routes:
- kind: Rule
match: Host(`myapp-ui.example.org`)
services:
- kind: Service
name: frontend-service
passHostHeader: true
port: 80
- kind: Rule
match: Host(`myapp-ui.example.org`) && Path(`/api`)
services:
- kind: Service
name: api-service
passHostHeader: true
port: 80