Zuul Gateway - setSendZuulResponse & removeRouteHost
Asked Answered
H

1

6

Just wanted some clarification - within Netflix's Zuul Gateway, the RequestContext object has two methods, setSendZuulResponse and removeRouteHost.

First, can somebody tell me the difference between the two. From this post, they do the same but I can't find documentation that describes these (sendZuulResponse and removeRouteHost).

Second, does the Zuul filter hit the resource/origin server regardless of being filtered but just hides the response to the client? Based on the documentation for sendZuulResponse, it says:

"If this value if true then the response should be sent to the client."

My rationale is, if this value is set to false, then the response should not* be sent to the client; However, Zuul has the response(???), which means that it had sent the request anyways (if that makes sense).

Thanks.

Hanaper answered 9/10, 2017 at 5:37 Comment(0)
P
0

if you are using the Spring Cloud Netflix Zuul dependency, then the SimpleHostRoutingFilter class, which is the one that makes the downstream call, only gets activated when the following code is met

RequestContext.getCurrentContext().getRouteHost() != null && RequestContext.getCurrentContext().sendZuulResponse();

From that we can see that if either the route host is null or if the Zuul response is set to false, the filter won't run and a request to the downstream service won't be made.

Poulterer answered 15/12, 2020 at 22:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.