This is the first article from a series about a very interesting framework developed by Netflix, named Zuul that can be used in many ways. This post presents how this framework can be used to dynamically route calls from one endpoint to another, according to a predefined list of rules.
As always, we offer the full implementation(here), but out of that, there are some conclusions we want to enumerate:
- Very easy to use it: just add the dependency in the pom.xml and an annotation in the main class
- It supports both yaml and properties file to define routing rules
- It perfectly supports both request parameter and path variable routing.
Checking other available materials on this topic, we found many places where this action is named “redirect”, but in our opinion the correct name is “forward”. Why? Because:
- the request is not processed by the called endpoint, but it arrives to the “final destination” without being altered
- In a browser, the URL will be the same
Feel free to clone the implementation, test it and let a comment here!