IngressRoute pointing to wrong service

Hi,

I'm tunning a Traefik deployment with 113 routers (mostly 50-ish services, both web and websecure).

I'm facing a problem with one of them, always pointing to the wrong service, and I do not know why (it used to work some time ago, do not know what actually changed in the middle).

Strange as it is, I do not see any log for the "wrong" router, only for the wrong router, pointing to the wrong service.

Like:

router1 -> host1 -> service1
router2 -> host2 -> service2

If I point to host1, it shows service2 and logs router2.

Is there a way to debug and/or understand whst's going on?

Thank you.

Ok, found the culprit.

I had on the first router:

match: Host(pgadmin.domain.com)

on the second:

Host(domain.com) || Hostregexp((admin|sub2|sub3|sub4|sub5|sub6|sub7)+.domain.com)

For some reason, navigating to pgadmin.domain.com gets covered by the Hostregexp (the admin subdomain), and hits the second router instead of the first one.

I solved by putting the admin subdomain outside the Hostregexp, in its own Host:

Host(domain.com) || Host(admin.domain.com) || Hostregexp((sub2|sub3|sub4|sub5|sub6|sub7)+.domain.com)

Is there a way to write a better hostregexp, covering just the very exact subdomains?

Thank you very much.

Solved by adding the "*" character in front of the subdomain(s) string:

Host(domain.com) || Hostregexp(^(admin|sub2|sub3|sub4|sub5|sub6|sub7).domain.com)

Thank you very much

You can simply set a higher priority for the pgadmin router. The regex router gets a higher priority by default because the rule is longer.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.