In Kong, you can add an Expressions route through the Admin API POST method:
Router Optimization
This DSL offers many convenient features, such as prefix matching (^=), suffix matching (=^), and IP address ranges in IpCidr format, allowing users to avoid expensive regular expressions. The enhanced expressive power can describe complex routing requirements in a single routing rule, reducing the number of rules needed.
The new design optimizes the order of checks and allows bypassing costly checks when appropriate. Expression routes are always evaluated in descending order of priority. Therefore, when configuring routes, you should set higher priority for more likely matches to improve efficiency:
Example of a likely match route:
Example of an unlikely match route:
Additionally, version 3.0 introduces condition-triggered partial route reconstruction, effectively avoiding the time consumption of global route reconstruction. In scenarios with many routes, benchmark tests show that the P99 time for route reconstruction reduced from 1.5 seconds to 0.1 seconds.
For more optimizations, refer to Kong’s official documentation: Kong Documentation.
Migration Path Between Old and New Routes (New Feature in Version 3.7)