Skip to content
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

Merged
merged 3 commits into from
Mar 12, 2018

Conversation

jbdoumenjou
Copy link
Member

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

  • Added/updated documentations

Copy link
Member

@juliens juliens left a 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).
Copy link
Contributor

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

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)`).
Copy link
Member

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 ?

Copy link
Contributor

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.

Copy link
Member Author

@jbdoumenjou jbdoumenjou Mar 12, 2018

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

Copy link
Contributor

@ldez ldez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@juliens juliens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@mmatur mmatur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants