Commit 9cb0207f by Johannes Edmeier

Use ZuulProperties

From Spring Cloud Brixton on, the PreDecorationFilter doesn't pass sensitive headers downstream. So the ZuulProperties from the ApplicationContext needs to be used (instead of creating a new instance), so that the properties can be customized.
parent 631f51ae
......@@ -20,12 +20,10 @@ import org.springframework.boot.actuate.endpoint.Endpoint;
import org.springframework.boot.actuate.trace.TraceRepository;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.cloud.netflix.zuul.RoutesEndpoint;
import org.springframework.cloud.netflix.zuul.ZuulConfiguration;
import org.springframework.cloud.netflix.zuul.filters.ProxyRequestHelper;
import org.springframework.cloud.netflix.zuul.filters.RouteLocator;
import org.springframework.cloud.netflix.zuul.filters.ZuulProperties;
import org.springframework.cloud.netflix.zuul.filters.pre.PreDecorationFilter;
import org.springframework.cloud.netflix.zuul.filters.route.SimpleHostRoutingFilter;
import org.springframework.cloud.netflix.zuul.web.ZuulHandlerMapping;
......@@ -47,9 +45,6 @@ public class RevereseZuulProxyConfiguration extends ZuulConfiguration {
private TraceRepository traces;
@Autowired
private ServerProperties server;
@Autowired
private ApplicationRegistry registry;
@Autowired
......@@ -65,20 +60,27 @@ public class RevereseZuulProxyConfiguration extends ZuulConfiguration {
adminServer.getContextPath() + "/api/applications/");
}
@Bean
public ProxyRequestHelper proxyRequestHelper() {
ProxyRequestHelper helper = new ProxyRequestHelper();
if (this.traces != null) {
helper.setTraces(this.traces);
}
helper.setIgnoredHeaders(this.zuulProperties.getIgnoredHeaders());
helper.setTraceRequestBody(this.zuulProperties.isTraceRequestBody());
return helper;
}
// pre filters
@Bean
public PreDecorationFilter preDecorationFilter() {
return new PreDecorationFilter(routeLocator(), this.server.getServletPrefix(),
new ZuulProperties(), new ProxyRequestHelper());
zuulProperties, proxyRequestHelper());
}
@Bean
public SimpleHostRoutingFilter simpleHostRoutingFilter() {
ProxyRequestHelper helper = new ProxyRequestHelper();
if (this.traces != null) {
helper.setTraces(this.traces);
}
return new SimpleHostRoutingFilter(helper, new ZuulProperties());
return new SimpleHostRoutingFilter(proxyRequestHelper(), zuulProperties);
}
@Bean
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment