-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify how setting a frontend priority works #2984
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
docs/basics.md
Outdated
@@ -234,7 +234,7 @@ The following rules are both `Matchers` and `Modifiers`, so the `Matcher` portio | |||
#### Priorities | |||
|
|||
By default, routes will be sorted (in descending order) using rules length (to avoid path overlap): | |||
`PathPrefix:/12345` will be matched before `PathPrefix:/1234` that will be matched before `PathPrefix:/1`. | |||
`PathPrefix:/12;Host:foo.com` (length == 27) will be matched before `PathPrefixStrip:/123` (length == 20) will be matched before `PathPrefix:/12,/3` (length == 17). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you replace numbers by letters.
ex: PathPrefix:/12
-> PathPrefix:/foo
44f5b50
to
cf1cc91
Compare
docs/basics.md
Outdated
@@ -254,7 +254,7 @@ You can customize priority by frontend. The priority value is added to the rule | |||
rule = "PathPrefix:/toto" | |||
``` | |||
|
|||
Here, `frontend1` will be matched before `frontend2` (`(3 + 10 == 13) > (4 + 5 == 9)`). | |||
Here, `frontend1` will be matched before `frontend2` (`(14 + 10 == 24) > (16 + 5 == 21)`). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that in reality, if you specify a priority, you don't use the length and use directly the value. Can you verify this ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Traefik 1.5, a custom priority does ignore the length-based factor according to my tests not too long ago.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I made a mistake, the priority override the rule length according to https://github.com/containous/traefik/blob/master/server/server.go#L1192
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
6dfbf11
to
64a8178
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
64a8178
to
ee70874
Compare
ee70874
to
18071ba
Compare
What does this PR do?
Update the documentation to clarify how setting a frontend priority works
Motivation
Some misunderstanding on the frontend priority mechanism
Related to #2722
More