From 594e80618a37a2e82490e32bc34c82687201b239 Mon Sep 17 00:00:00 2001 From: Spencer Gibb Date: Tue, 14 Feb 2017 21:13:57 -0700 Subject: [PATCH] add RemoveNonProxyHeaders filter --- .../cloud/gateway/config/GatewayProperties.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/springframework/cloud/gateway/config/GatewayProperties.java b/src/main/java/org/springframework/cloud/gateway/config/GatewayProperties.java index 114ea1167..3ca683253 100644 --- a/src/main/java/org/springframework/cloud/gateway/config/GatewayProperties.java +++ b/src/main/java/org/springframework/cloud/gateway/config/GatewayProperties.java @@ -3,12 +3,15 @@ package org.springframework.cloud.gateway.config; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; + import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.cloud.gateway.api.FilterDefinition; import org.springframework.cloud.gateway.api.Route; +import org.springframework.cloud.gateway.filter.route.RemoveNonProxyHeadersRouteFilter; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; +import static org.springframework.cloud.gateway.support.NameUtils.normalizeFilterName; /** * @author Spencer Gibb @@ -26,7 +29,15 @@ public class GatewayProperties { /** * List of filter definitions that are applied to every route. */ - private List defaultFilters = new ArrayList<>(); + private List defaultFilters = loadDefaults(); + + private ArrayList loadDefaults() { + ArrayList defaults = new ArrayList<>(); + FilterDefinition definition = new FilterDefinition(); + definition.setName(normalizeFilterName(RemoveNonProxyHeadersRouteFilter.class)); + defaults.add(definition); + return defaults; + } public List getRoutes() { return routes;