This tutorial is the continuation of Spring Cloud: Exploring Zuul Gateway tutorial. In this tutorial, we will be exploring the functionality of filters provided by Zuul.
As discussed earlier Zuul provides various filters which we can use for request validation or processing. Let’s say if you have an incoming request and if you want to check whether the user is authenticated or not, you can use Zuul pre-filter for this. If your request is processed and if you want to encrypt the response you can use Zuul post filter. The major upside of Zuul filter is, you can manage all of your filters at a centralized location.
Zuul has provision to create following four types of filter.
prefilters run before the request is routed.routefilters can handle the actual routing of the request.postfilters run after the request has been routed.errorfilters run if an error occurs while handling the request.