Hi, I am running Traefik as an ingress controller in my k8s cluster. I want to use an ingressroute for my Matrix server so I need the following routes working properly:
Under the host matrix.artichoke.cc
, the following paths must be routed to the mas-main
service:
/_matrix/client/*/login
/_matrix/client/*/logout
/_matrix/client/*/refresh
Every other route under matrix.artichoke.cc
must be routed to synapse-matrix-synapse
.
Every route under mas.artichoke.cc
must be routed to the mas-main
service.
So, do do this, I have created the following ingressroute:
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
annotations:
cert-manager.io/cluster-issuer: letsencrypt-production
name: synapse
namespace: synapse
spec:
entryPoints:
- websecure
routes:
- kind: Rule
match: Host(`matrix.artichoke.cc`) && PathRegexp(`^/_matrix/client/(.*)/(login|logout|refresh)`)
priority: 100
services:
- name: mas-main
port: 8081
- kind: Rule
match: Host(`matrix.artichoke.cc`) && PathPrefix(`/`)
priority: 10
services:
- name: synapse-matrix-synapse
port: 8008
- kind: Rule
match: Host(`artichoke.cc`) && PathPrefix(`/.well-known/matrix/`)
services:
- name: synapse-wellknown-lighttpd
port: 80
- kind: Rule
match: Host(`mas.artichoke.cc`) && PathPrefix(`/`)
services:
- name: mas-main
port: 8081
tls:
secretName: tls-secret
However, when I try routes such as /_matrix/client/v2/login
, they get routed to the synapse backend rather than the mas backend. I made sure they were listed in the right order, so that they don't get caught in the root rule, but this did not work. So, as you can see, I set explicit priorities. This did not work either.
I am using Traefik v2.
It seems like Traefik is either ignoring my priorities or calculating them incorrectly. How can I solve this problem?