easegress-io / easegress

A Cloud Native traffic orchestration system

Home Page:https://megaease.com/easegress/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

add a new routing policy to HTTPServer

localvar opened this issue · comments

There are two types of HTTP routing policies, both have their advantages and disadvantages:

  • match route entries in the order of configuration
  • match exact path first, then prefixes (from longer to shorter), then regular expressions (in the configured order)

currently, Easegress only supports the 1st, but users are asking for the 2nd. The solution would be:

  • implement the 2nd policy
  • add an option to the spec of HTTPServer to let the user select which policy is desired

To support the 2nd policy, the following matching algorithms can be considered.

  • exact matching, we can use the hash table
  • prefix matching, we can use the radix tree
  • regex matching, we only can do in-order checking.

Consider plugging in the route so that users can customize the route implementation