Restricting paths in Kong


#1

Hi!
I’ve created 2 paths like these: /auth/v3/ui/([a-zA-Z0-9±_]+) and /auth/v3/oauth/token .

  • When I curl /auth/v3/aaa - I get “no route and no API found”, great.
  • /auth/v3/oauth/token - my app reply.
  • /auth/v3/oauth/tokeQQQn - “no route and no API found”,
  • /auth/v3/oauth/tokenQQQ - my app reply. This is undesirable behavior.
  • /auth/v3/oauth/token/QQQ - my app reply. This is undesirable behavior.
  • /auth/v3/ui/aa-aaA1- my app reply.
  • /auth/v3/ui/aa-aaA1/qq-qq - my app reply. This is undesirable behavior.
    Could you please help me to define the paths’ endings explicitly? Maybe with regex as well.

Thanks in advance!


#2

I’ve worked it around with the separate route, pointing to /auth/v3/oauth/token([a-zA-Z0-9±_]+) and terminated with “request-termination” plugin. That is an ugly workaround. Shoud be anything simpler though. Now the queries #4,5,7 return 404 as expected.
@hbagdi, maybe there is a more efficient way?