Questions about the principle of routes matching

Hi everyone~

I need to apply the login authentication plug-in to the specified api path.

For example,

  • if there is a Route named ‘Route1’ and it’s path is '/api/phone',

  • I want to apply the authentication plug-in to all requests under the path of '/api/phone/sell'.
    So I built a Route named ‘Route2’ with path:'/api/phone/sell'.

But when I actually called it, it was different from what I expected.

When my request path is '/api/phone/sell', the matched Route is ‘Route1’. Only when my request path is '/api/phone/sell/abc' can I match ‘Route2’.

This has caused me confusion, because I recently upgraded my version of kong from 0.14.x to 1.3.x, and there was no such problem in the previous version. Is it because I don’t understand the path matching principle correctly, or is there some adjustments in Kong after a certain version?

All help appreciated :slight_smile:

I know that you can match all requests under the sell path by writing the regular expression /api/phone/sell[\s\S]*$, but shouldn’t this be the default operation?

This problem has not been solved yet, can anyone give some suggestions?:slight_smile:

I am still waiting for a reply :thinking:

© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ