Traefik 2.0 , HostRegexp Routing unexpected effect each other

hi every one
i think there is a bug in routing for hostregexp rule.
i submitted an issue for it traefiker bot labeled it as question!!

issue link

please someone take a look and inform me if i am wrong!
thanks in advaced

Hello,

the HostRegexp syntax is:

HostRegexp(`{groupname:expression}`)"
HostRegexp(`{group:[a-z]+}.example.com`)

So when you write:

HostRegexp(`{localhssdost}`)"

it's just a just a group name without expression.

https://docs.traefik.io/v2.0/routing/routers/#rule

Thank you so much.
Sorry for not reading docs carefully!!

I dont get it. What does "group name" mean in this context?
Given HostRegexp({group:[a-z]+}.example.com), could you give an example of both matching and non-matching hostnames? I'm really struggling to parse the documentation on this. I really wish Traefik made it easier to set up wildcard/subdomain matching without being a Go/Regex expert. A few lines of examples and explanation would go a long way.

I answered you in your other thread, but while confusion with unsed group name is understandable - I was wondering about that too when I first saw it, once that's cleared out, the rest I feel is clear.

This is standard Regex otherwise; go's dialect. You don't have to be Regex expert, you don't have use this particular rule at all if you are uncomfortable. But as anything in advanced technolgy traefik do rely on basic level of competence in its users. Regex is very wide-spread, well understood, and fit very well for what traefik is using it for.

Coplaining about usage of Regex with traefik is similar to compaining about usage of Regex with grep, e.g. does not make much sesnes.

I also do not feel that traefik documentation is the right place to teach users Regex, there are much better sources for that, and the documentation links one - the go's own Regex reference.

The bottom line - I'm happy to help with your struggling, but I feel it's unfair that your attribute your struggle with Regex to trafik documentation, I think that belongs elsewhere.

Sorry, I didnt' mean it like that. I'll try and rephrase:

Looking at the "routers" documentation page (https://docs.traefik.io/routing/routers/):
Host and Path rules have very clear and easy to understand examples:

...and then HostRegexp (which is a far more complicated rule) only has:

IMHO this is not enough documentation to make it easy to understand what to do. My use case was a seemingly super-simple subdomain wildcard, and there was nothing in the documentation to help me - I had to do a mix of stackoverflow, regexp trial-and-error to get it done. Very frustrating. Granted, I'm not very proficient at regexp but even for an expert I would assume than better documentation would be welcome and allow users to solve tasks quicker.

2 Likes