Reputation: 61
How do you implement and configure ZuulFilter of type "route" when using spring-cloud-starter-zuul
? The idea is that instead of forwarding to another service, I would like a certain ZuulFilter to handle the request and not forward to another service.
Upvotes: 2
Views: 738
Reputation: 25147
The preferred way to do this is to setup a route that forwards to a local spring mvc controller, rather than trying to have a zuul filter deal with it.
zuul:
routes:
second:
path: /second/**
url: forward:/second
And then somewhere in the zuul app is a controller
@RestController
public class Second {
@RequestMapping("/second/{value}") /* etc... */
}
You could do it in zuul filters, but it very unwieldy. This way, you take advantage of the ease of spring MVC.
Upvotes: 3