I am wondering what use case would be served by @EnableZuulServer
?
In my case I want to use the ZuulFilter framework for micro-services, and also the spring handlerMappings on Controllers to be called after passing through the Zuul Filter framework. Do not want proxy forwarding.
Is that possible and how? Can we use @EnableZuulServer
mode for this scenario? I didn't find much documentation to be able to understand how @EnableZuulServer
would work.
Can someone explain and help?
From the Spring Cloud Netflix documentation:
Based on that, the answer to your question is: yes.
You can add the
@EnableZuulServer
annotation and you will not get proxy forwarding but you will still be able to use theZuulFilter
framework.That said, if you're just looking to filter requests and responses, you can use a standard Servlet
Filter
along with aFilterRegistrationBean
(relevant javadoc)As far as a use case goes, you'd use
@EnableZuulServer
when you need more customized behavior than what is available with@EnableZuulProxy
.So, for instance, maybe for debug purposes you want to be able to support a request header that proxies your request to a specified host when the request originates from within a specific IP range.