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;