You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apisix.apache.org by Jan Li <ja...@airwallex.com> on 2020/03/27 02:19:42 UTC

Priority of routes

Hi team,

        Could you please help me confirm the priority of route matching?
Especially when multiple routes include wildcards.

        For example, I have 3 routes configured:

        /foo/bar
        /foo/*
        /*

        I suppose the behavior is like this:
        /foo/bar will match /foo/bar
        /foo/foo will match /foo/*
        /bar will match /*

        Is this correct?

Re: Priority of routes

Posted by Ming Wen <we...@apache.org>.
welcome add this question to FAQ of APISIX

Jan Li <ja...@airwallex.com>于2020年3月27日 周五上午11:22写道:

> Thanks YuanSheng.
>
> On Fri, Mar 27, 2020 at 11:13 AM YuanSheng Wang <me...@apache.org>
> wrote:
>
> > > Is this correct?
> >
> > yes, you are right.
> >
> > match step:
> > 1. fully matching
> > 2. prefix matching: Sort by prefix length, longer matches first
> >
> > On Fri, Mar 27, 2020 at 10:20 AM Jan Li <ja...@airwallex.com> wrote:
> > >
> > > Hi team,
> > >
> > >         Could you please help me confirm the priority of route
> matching?
> > > Especially when multiple routes include wildcards.
> > >
> > >         For example, I have 3 routes configured:
> > >
> > >         /foo/bar
> > >         /foo/*
> > >         /*
> > >
> > >         I suppose the behavior is like this:
> > >         /foo/bar will match /foo/bar
> > >         /foo/foo will match /foo/*
> > >         /bar will match /*
> > >
> > >         Is this correct?
> >
> >
> >
> > --
> > MembPhis
> > My github: https://github.com/membphis
> > Apache APISIX: https://github.com/apache/incubator-apisix
> >
>
-- 
Thanks,
Ming Wen, Apache APISIX & Apache SkyWalking
Twitter: _WenMing

Re: Priority of routes

Posted by Jan Li <ja...@airwallex.com>.
Thanks YuanSheng.

On Fri, Mar 27, 2020 at 11:13 AM YuanSheng Wang <me...@apache.org> wrote:

> > Is this correct?
>
> yes, you are right.
>
> match step:
> 1. fully matching
> 2. prefix matching: Sort by prefix length, longer matches first
>
> On Fri, Mar 27, 2020 at 10:20 AM Jan Li <ja...@airwallex.com> wrote:
> >
> > Hi team,
> >
> >         Could you please help me confirm the priority of route matching?
> > Especially when multiple routes include wildcards.
> >
> >         For example, I have 3 routes configured:
> >
> >         /foo/bar
> >         /foo/*
> >         /*
> >
> >         I suppose the behavior is like this:
> >         /foo/bar will match /foo/bar
> >         /foo/foo will match /foo/*
> >         /bar will match /*
> >
> >         Is this correct?
>
>
>
> --
> MembPhis
> My github: https://github.com/membphis
> Apache APISIX: https://github.com/apache/incubator-apisix
>

Re: Priority of routes

Posted by YuanSheng Wang <me...@apache.org>.
> Is this correct?

yes, you are right.

match step:
1. fully matching
2. prefix matching: Sort by prefix length, longer matches first

On Fri, Mar 27, 2020 at 10:20 AM Jan Li <ja...@airwallex.com> wrote:
>
> Hi team,
>
>         Could you please help me confirm the priority of route matching?
> Especially when multiple routes include wildcards.
>
>         For example, I have 3 routes configured:
>
>         /foo/bar
>         /foo/*
>         /*
>
>         I suppose the behavior is like this:
>         /foo/bar will match /foo/bar
>         /foo/foo will match /foo/*
>         /bar will match /*
>
>         Is this correct?



-- 
MembPhis
My github: https://github.com/membphis
Apache APISIX: https://github.com/apache/incubator-apisix