Class GatewayFilterSpec
java.lang.Object
org.springframework.cloud.gateway.route.builder.UriSpec
org.springframework.cloud.gateway.route.builder.GatewayFilterSpec
Applies specific filters to routes.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionGatewayFilterSpec(Route.AsyncBuilder routeBuilder, RouteLocatorBuilder.Builder builder) -
Method Summary
Modifier and TypeMethodDescriptionaddRequestHeader(String headerName, String headerValue) Adds a request header to the request before it is routed by the Gateway.addRequestHeadersIfNotPresent(String... headers) Adds a request header to the request before it is routed by the Gateway.addRequestParameter(String param, String value) Adds a request parameter to the request before it is routed by the Gateway.addResponseHeader(String headerName, String headerValue) Adds a header to the response returned to the Gateway from the route.addResponseHeader(String headerName, String headerValue, boolean override) Adds a header to the response returned to the Gateway from the route.cacheRequestBody(Class<?> bodyClass) A filter that can cache the request body.changeRequestUri(Function<org.springframework.web.server.ServerWebExchange, Optional<URI>> determineRequestUri) A filter which change the URI the request will be routed to by the Gateway.circuitBreaker(Consumer<SpringCloudCircuitBreakerFilterFactory.Config> configConsumer) dedupeResponseHeader(String headerName, String strategy) A filter that removes duplication on a response header before it is returned to the client by the Gateway.fallbackHeaders(Consumer<FallbackHeadersGatewayFilterFactory.Config> configConsumer) Adds hystrix execution exception headers to fallback request.Adds hystrix execution exception headers to fallback request.filter(GatewayFilter gatewayFilter) Applies the filter to the route.filter(GatewayFilter gatewayFilter, int order) Applies the filter to the route.filter(GatewayFilter gatewayFilter, int order, boolean forceOrder) Applies the filter to the route.filters(Collection<GatewayFilter> gatewayFilters) Applies the list of filters to the route.filters(GatewayFilter... gatewayFilters) Applies the list of filters to the route.jsonToGRPC(String service, String method, String protoDescriptor) A filter that transforms a JSON request into a gRPC one.localResponseCache(@Nullable Duration timeToLive, @Nullable org.springframework.util.unit.DataSize size) A filter that adds a local cache for storing response body for repeated requests.mapRequestHeader(String fromHeader, String toHeader) Maps headers from one name to another.<T,R> GatewayFilterSpec modifyRequestBody(Class<T> inClass, Class<R> outClass, @Nullable String newContentType, RewriteFunction<T, R> rewriteFunction) A filter that can be used to modify the request body.<T,R> GatewayFilterSpec modifyRequestBody(Class<T> inClass, Class<R> outClass, RewriteFunction<T, R> rewriteFunction) A filter that can be used to modify the request body.<T,R> GatewayFilterSpec modifyRequestBody(Consumer<ModifyRequestBodyGatewayFilterFactory.Config> configConsumer) A filter that can be used to modify the request body.<T,R> GatewayFilterSpec modifyRequestBody(org.springframework.core.ParameterizedTypeReference<T> inClass, org.springframework.core.ParameterizedTypeReference<R> outClass, @Nullable String newContentType, RewriteFunction<T, R> rewriteFunction) A filter that can be used to modify the request body.<T,R> GatewayFilterSpec modifyRequestBody(org.springframework.core.ParameterizedTypeReference<T> inClass, org.springframework.core.ParameterizedTypeReference<R> outClass, RewriteFunction<T, R> rewriteFunction) A filter that can be used to modify the request body.<T,R> GatewayFilterSpec modifyResponseBody(Class<T> inClass, Class<R> outClass, String newContentType, RewriteFunction<T, R> rewriteFunction) A filter that can be used to modify the response body.<T,R> GatewayFilterSpec modifyResponseBody(Class<T> inClass, Class<R> outClass, RewriteFunction<T, R> rewriteFunction) A filter that can be used to modify the response body.<T,R> GatewayFilterSpec modifyResponseBody(Consumer<ModifyResponseBodyGatewayFilterFactory.Config> configConsumer) A filter that can be used to modify the response body using custom spec.prefixPath(String prefix) A filter that can be used to add a prefix to the path of a request before it is routed by the Gateway.A filter that will preserve the host header of the request on the outgoing request from the Gateway.A filter that will return a redirect response back to the client.A filter that will return a redirect response back to the client.A filter that will return a redirect response back to the client.A filter that will return a redirect response back to the client.A filter that will return a redirect response back to the client.A filter that will return a redirect response back to the client.A filter that will return a redirect response back to the client.A filter that will return a redirect response back to the client.A filter that will return a redirect response back to the client.removeJsonAttributes(boolean deleteRecursively, String... attributes) A filter that can be used to modify the response body.removeJsonAttributes(String... attributes) A filter that can be used to modify the response body.removeRequestHeader(String headerName) A filter that will remove a request header before the request is routed by the Gateway.removeRequestParameter(String paramName) A filter that will remove a request param before the request is routed by the Gateway.removeResponseHeader(String headerName) A filter that will remove a response header before the Gateway returns the response to the client.requestHeaderToRequestUri(String headerName) A filter which changes the URI the request will be routed to by the Gateway by pulling it from a header on the request.A filter that will set up a request rate limiter for a route.requestRateLimiter(Consumer<RequestRateLimiterGatewayFilterFactory.Config> configConsumer) A filter that will set up a request rate limiter for a route.retry(int retries) A filter that will retry failed requests.retry(Consumer<RetryGatewayFilterFactory.RetryConfig> retryConsumer) A filter that will retry failed requests.retry(reactor.retry.Repeat<org.springframework.web.server.ServerWebExchange> repeat, reactor.retry.Retry<org.springframework.web.server.ServerWebExchange> retry) A filter that will retry failed requests.rewriteLocationResponseHeader(String stripVersionMode, String locationHeaderName, String hostValue, String protocolsRegex) A filter that rewrites the value of Location response header, ridding it of backend specific details.rewritePath(String regex, String replacement) A filter which rewrites the request path before it is routed by the Gateway.rewriteRequestParameter(String name, String replacement) A filter that rewrites the value of a request parameterrewriteResponseHeader(String headerName, String regex, String replacement) A filter that rewrites a header value on the response before it is returned to the client by the Gateway.A filter which forces aWebSession::saveoperation before forwarding the call downstream.A filter that adds a number of headers to the response at the reccomendation from this blog post.secureHeaders(Consumer<SecureHeadersGatewayFilterFactory.Config> configConsumer) A filter that adds a number of headers to the response at the reccomendation from this blog post.setHostHeader(String hostName) A filter that will set the Host header to on the outgoing request.A filter that sets the path of the request before it is routed by the Gateway.setRequestHeader(String headerName, String headerValue) A filter that sets a header on the request before it is routed by the Gateway.setRequestHeaderSize(org.springframework.util.unit.DataSize size) A filter that sets the maximum permissible size of headers of Request.setRequestSize(Long size) A filter that sets the maximum permissible size of a Content-Length header value in the Request.setRequestSize(org.springframework.util.unit.DataSize size) A filter that sets the maximum permissible size of a Content-Length header value in the Request.setRequestUri(String uri) A filter which changes the URI the request will be routed to by the Gateway by pulling it from a header on the request.setResponseHeader(String headerName, String headerValue) A filter that sets a header on the response before it is returned to the client by the Gateway.setStatus(int status) A filter that sets the status on the response before it is returned to the client by the Gateway.A filter that sets the status on the response before it is returned to the client by the Gateway.setStatus(org.springframework.http.HttpStatus status) A filter that sets the status on the response before it is returned to the client by the Gateway.stripPrefix(int parts) Strips the prefix from the path of the request before it is routed by the Gateway.A filter that enables token relay by extracting the access token from the currently authenticated user and puts it in a request header for downstream requests.tokenRelay(String clientRegistrationId) A filter that enables token relay by extracting the access token of a specifiedClientRegistrationand puts it in a request header for downstream requests.transformToOrderedFilters(Stream<GatewayFilter> stream)
-
Constructor Details
-
GatewayFilterSpec
-
-
Method Details
-
filter
Applies the filter to the route.- Parameters:
gatewayFilter- the filter to apply- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
filter
Applies the filter to the route.- Parameters:
gatewayFilter- the filter to applyorder- the order to apply the filter- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
filter
Applies the filter to the route.- Parameters:
gatewayFilter- the filter to applyorder- the order to apply the filterforceOrder- iftrue, then force the order even if the suppliedGatewayFilterimplementsOrdered- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
filters
Applies the list of filters to the route.- Parameters:
gatewayFilters- the filters to apply- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
transformToOrderedFilters
-
filters
Applies the list of filters to the route.- Parameters:
gatewayFilters- the filters to apply- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
addRequestHeader
Adds a request header to the request before it is routed by the Gateway.- Parameters:
headerName- the header nameheaderValue- the header value- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
addRequestHeadersIfNotPresent
Adds a request header to the request before it is routed by the Gateway.- Parameters:
headers- the header name(s) and value(s) as 'name-1:value-1,name-2:value-2,...'- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
addRequestParameter
Adds a request parameter to the request before it is routed by the Gateway.- Parameters:
param- the parameter namevalue- the parameter vaule- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
addResponseHeader
Adds a header to the response returned to the Gateway from the route.- Parameters:
headerName- the header nameheaderValue- the header value- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
addResponseHeader
Adds a header to the response returned to the Gateway from the route.- Parameters:
headerName- the header nameheaderValue- the header valueoverride- override or not- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
localResponseCache
public GatewayFilterSpec localResponseCache(@Nullable Duration timeToLive, @Nullable org.springframework.util.unit.DataSize size) A filter that adds a local cache for storing response body for repeated requests.If `timeToLive` and `size` are null, a global cache is used configured by the global configuration
LocalResponseCacheProperties.- Parameters:
timeToLive- time an entry is kept in cache. Default: 5 minutessize- size expression to limit cache size (See format inDataSize. Default:null(no limit)- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
dedupeResponseHeader
A filter that removes duplication on a response header before it is returned to the client by the Gateway.- Parameters:
headerName- the header name(s), space separatedstrategy- RETAIN_FIRST, RETAIN_LAST, or RETAIN_UNIQUE- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
circuitBreaker
public GatewayFilterSpec circuitBreaker(Consumer<SpringCloudCircuitBreakerFilterFactory.Config> configConsumer) -
jsonToGRPC
A filter that transforms a JSON request into a gRPC one.- Parameters:
service- fully qualified name of the service that will handle the request.method- method name in the service that will handle the request.protoDescriptor- relative path to the proto descriptor file.
-
mapRequestHeader
Maps headers from one name to another.- Parameters:
fromHeader- the header name of the original header.toHeader- the header name of the new header.- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
modifyRequestBody
public <T,R> GatewayFilterSpec modifyRequestBody(Class<T> inClass, Class<R> outClass, RewriteFunction<T, R> rewriteFunction) A filter that can be used to modify the request body.- Type Parameters:
T- the original request body classR- the new request body class- Parameters:
inClass- the class to convert the incoming request body tooutClass- the class the Gateway will add to the request before it is routedrewriteFunction- theRewriteFunctionthat transforms the request body- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
modifyRequestBody
public <T,R> GatewayFilterSpec modifyRequestBody(org.springframework.core.ParameterizedTypeReference<T> inClass, org.springframework.core.ParameterizedTypeReference<R> outClass, RewriteFunction<T, R> rewriteFunction) A filter that can be used to modify the request body.- Type Parameters:
T- the original request body classR- the new request body class- Parameters:
inClass- the parameterized type reference to convert the incoming request body tooutClass- the parameterized type reference the Gateway will add to the request before it is routedrewriteFunction- theRewriteFunctionthat transforms the request body- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
modifyRequestBody
public <T,R> GatewayFilterSpec modifyRequestBody(Class<T> inClass, Class<R> outClass, @Nullable String newContentType, RewriteFunction<T, R> rewriteFunction) A filter that can be used to modify the request body.- Type Parameters:
T- the original request body classR- the new request body class- Parameters:
inClass- the class to convert the incoming request body tooutClass- the class the Gateway will add to the request before it is routednewContentType- the new Content-Type header to be sentrewriteFunction- theRewriteFunctionthat transforms the request body- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
modifyRequestBody
public <T,R> GatewayFilterSpec modifyRequestBody(org.springframework.core.ParameterizedTypeReference<T> inClass, org.springframework.core.ParameterizedTypeReference<R> outClass, @Nullable String newContentType, RewriteFunction<T, R> rewriteFunction) A filter that can be used to modify the request body.- Type Parameters:
T- the original request body classR- the new request body class- Parameters:
inClass- the parameterized type reference to convert the incoming request body tooutClass- the parameterized type reference the Gateway will add to the request before it is routednewContentType- the new Content-Type header to be sentrewriteFunction- theRewriteFunctionthat transforms the request body- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
cacheRequestBody
A filter that can cache the request body.- Parameters:
bodyClass- the class to convert the incoming request body to the original request body class- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
modifyRequestBody
public <T,R> GatewayFilterSpec modifyRequestBody(Consumer<ModifyRequestBodyGatewayFilterFactory.Config> configConsumer) A filter that can be used to modify the request body.- Type Parameters:
T- the original request body classR- the new request body class- Parameters:
configConsumer- request spec for response modification- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters... .modifyRequestBody(c -> c .setInClass(Some.class) .setOutClass(SomeOther.class) .setInHints(hintsIn) .setOutHints(hintsOut) .setRewriteFunction(rewriteFunction))
-
modifyResponseBody
public <T,R> GatewayFilterSpec modifyResponseBody(Class<T> inClass, Class<R> outClass, RewriteFunction<T, R> rewriteFunction) A filter that can be used to modify the response body.- Type Parameters:
T- the original response body classR- the new response body class- Parameters:
inClass- the class to conver the response body tooutClass- the class the Gateway will add to the response before it is returned to the clientrewriteFunction- theRewriteFunctionthat transforms the response body- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
modifyResponseBody
public <T,R> GatewayFilterSpec modifyResponseBody(Class<T> inClass, Class<R> outClass, String newContentType, RewriteFunction<T, R> rewriteFunction) A filter that can be used to modify the response body.- Type Parameters:
T- the original response body classR- the new response body class- Parameters:
inClass- the class to conver the response body tooutClass- the class the Gateway will add to the response before it is returned to the clientnewContentType- the new Content-Type header to be returnedrewriteFunction- theRewriteFunctionthat transforms the response body- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
modifyResponseBody
public <T,R> GatewayFilterSpec modifyResponseBody(Consumer<ModifyResponseBodyGatewayFilterFactory.Config> configConsumer) A filter that can be used to modify the response body using custom spec.- Type Parameters:
T- the original response body classR- the new response body class- Parameters:
configConsumer- response spec for response modification- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters... .modifyResponseBody(c -> c .setInClass(Some.class) .setOutClass(SomeOther.class) .setOutHints(hintsOut) .setRewriteFunction(rewriteFunction))
-
prefixPath
A filter that can be used to add a prefix to the path of a request before it is routed by the Gateway.- Parameters:
prefix- the prefix to add to the path- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
preserveHostHeader
A filter that will preserve the host header of the request on the outgoing request from the Gateway.- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
setHostHeader
A filter that will set the Host header to on the outgoing request.- Parameters:
hostName- the updated Host header value- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
redirect
A filter that will return a redirect response back to the client.- Parameters:
status- an HTTP status code, should be a300series redirecturl- the URL to redirect to. This URL will be set in thelocationheader- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
redirect
A filter that will return a redirect response back to the client.- Parameters:
status- an HTTP status code, should be a300series redirecturl- the URL to redirect to. This URL will be set in thelocationheaderincludeRequestParams- if true, query params will be passed to the url- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
redirect
A filter that will return a redirect response back to the client.- Parameters:
status- an HTTP status code, should be a300series redirecturl- the URL to redirect to. This URL will be set in thelocationheader- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
redirect
A filter that will return a redirect response back to the client.- Parameters:
status- an HTTP status code, should be a300series redirecturl- the URL to redirect to. This URL will be set in thelocationheaderincludeRequestParams- if true, query params will be passed to the url- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
redirect
A filter that will return a redirect response back to the client.- Parameters:
status- an HTTP status code, should be a300series redirecturl- the URL to redirect to. This URL will be set in thelocationheader- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
redirect
A filter that will return a redirect response back to the client.- Parameters:
status- an HTTP status code, should be a300series redirecturl- the URL to redirect to. This URL will be set in thelocationheaderincludeRequestParams- if true, query params will be passed to the url- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
redirect
A filter that will return a redirect response back to the client.- Parameters:
status- an HTTP status code, should be a300series redirecturl- the URL to redirect to. This URL will be set in thelocationheader- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
redirect
A filter that will return a redirect response back to the client.- Parameters:
status- an HTTP status code, should be a300series redirecturl- the URL to redirect to. This URL will be set in thelocationheader- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
redirect
public GatewayFilterSpec redirect(org.springframework.http.HttpStatus status, URL url, boolean includeRequestParams) A filter that will return a redirect response back to the client.- Parameters:
status- an HTTP status code, should be a300series redirecturl- the URL to redirect to. This URL will be set in thelocationheaderincludeRequestParams- if true, query params will be passed to the url- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
removeJsonAttributes
A filter that can be used to modify the response body. By default, this only removes root attributes.- Parameters:
attributes- list of attributes to remove.- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
removeJsonAttributes
A filter that can be used to modify the response body.- Parameters:
deleteRecursively- if true, all attributes regardless of nesting will be removed.attributes- list of attributes to remove.- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
removeRequestHeader
A filter that will remove a request header before the request is routed by the Gateway.- Parameters:
headerName- the name of the header to remove- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
removeRequestParameter
A filter that will remove a request param before the request is routed by the Gateway.- Parameters:
paramName- the name of the header to remove- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
removeResponseHeader
A filter that will remove a response header before the Gateway returns the response to the client.- Parameters:
headerName- the name of the header to remove- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
requestRateLimiter
public GatewayFilterSpec requestRateLimiter(Consumer<RequestRateLimiterGatewayFilterFactory.Config> configConsumer) A filter that will set up a request rate limiter for a route.- Parameters:
configConsumer- aConsumerthat will return configuration for the rate limiter- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
requestRateLimiter
A filter that will set up a request rate limiter for a route.- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
rewritePath
A filter which rewrites the request path before it is routed by the Gateway.- Parameters:
regex- a Java regular expression to match the path againstreplacement- the replacement for the path- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
retry
A filter that will retry failed requests. By default5xxerrors andGETs are retryable.- Parameters:
retries- max number of retries- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
retry
A filter that will retry failed requests.- Parameters:
retryConsumer- aConsumerwhich returns aRetryGatewayFilterFactory.RetryConfigto configure the retry functionality- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
retry
public GatewayFilterSpec retry(reactor.retry.Repeat<org.springframework.web.server.ServerWebExchange> repeat, reactor.retry.Retry<org.springframework.web.server.ServerWebExchange> retry) A filter that will retry failed requests.- Parameters:
repeat- aRepeatretry- aRetry- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
secureHeaders
A filter that adds a number of headers to the response at the reccomendation from this blog post.- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
secureHeaders
public GatewayFilterSpec secureHeaders(Consumer<SecureHeadersGatewayFilterFactory.Config> configConsumer) A filter that adds a number of headers to the response at the reccomendation from this blog post.- Parameters:
configConsumer- self define headers- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
setPath
A filter that sets the path of the request before it is routed by the Gateway.- Parameters:
template- the path to set on the request, allows multiple matching segments using URI templates from Spring Framework- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
setRequestHeader
A filter that sets a header on the request before it is routed by the Gateway.- Parameters:
headerName- the header nameheaderValue- the value of the header- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
setResponseHeader
A filter that sets a header on the response before it is returned to the client by the Gateway.- Parameters:
headerName- the header nameheaderValue- the value of the header- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
rewriteResponseHeader
A filter that rewrites a header value on the response before it is returned to the client by the Gateway.- Parameters:
headerName- the header nameregex- a Java regular expression to match the path againstreplacement- the replacement for the path- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
rewriteLocationResponseHeader
public GatewayFilterSpec rewriteLocationResponseHeader(String stripVersionMode, String locationHeaderName, String hostValue, String protocolsRegex) A filter that rewrites the value of Location response header, ridding it of backend specific details.- Parameters:
stripVersionMode- NEVER_STRIP, AS_IN_REQUEST, or ALWAYS_STRIPlocationHeaderName- a location header namehostValue- host valueprotocolsRegex- a valid regex String, against which the protocol name will be matched- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
rewriteRequestParameter
A filter that rewrites the value of a request parameter- Parameters:
name- The name of the request parameter to replacereplacement- The new value for the request parameter- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
setStatus
A filter that sets the status on the response before it is returned to the client by the Gateway.- Parameters:
status- the status to set on the response- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
setStatus
A filter that sets the status on the response before it is returned to the client by the Gateway.- Parameters:
status- the status to set on the response- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
setStatus
A filter that sets the status on the response before it is returned to the client by the Gateway.- Parameters:
status- the status to set on the response- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
saveSession
A filter which forces aWebSession::saveoperation before forwarding the call downstream. This is of particular use when using something like Spring Session with a lazy data store and need to ensure the session state has been saved before making the forwarded call. If you are integrating Spring Security with Spring Session, and want to ensure security details have been forwarded to the remote process, this is critical.- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
stripPrefix
Strips the prefix from the path of the request before it is routed by the Gateway.- Parameters:
parts- the number of parts of the path to remove- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
requestHeaderToRequestUri
A filter which changes the URI the request will be routed to by the Gateway by pulling it from a header on the request.- Parameters:
headerName- the header name containing the URI- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
setRequestUri
A filter which changes the URI the request will be routed to by the Gateway by pulling it from a header on the request.- Parameters:
uri- the URI- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
changeRequestUri
public GatewayFilterSpec changeRequestUri(Function<org.springframework.web.server.ServerWebExchange, Optional<URI>> determineRequestUri) A filter which change the URI the request will be routed to by the Gateway.- Parameters:
determineRequestUri- aFunctionwhich takes aServerWebExchangeand returns a URI to route the request to- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
setRequestSize
A filter that sets the maximum permissible size of a Content-Length header value in the Request.- Parameters:
size- the maximum size of a request- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
setRequestSize
A filter that sets the maximum permissible size of a Content-Length header value in the Request.- Parameters:
size- the maximum size of a request- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
setRequestHeaderSize
A filter that sets the maximum permissible size of headers of Request.- Parameters:
size- the maximum size of header of request- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
tokenRelay
A filter that enables token relay by extracting the access token from the currently authenticated user and puts it in a request header for downstream requests.- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
tokenRelay
A filter that enables token relay by extracting the access token of a specifiedClientRegistrationand puts it in a request header for downstream requests.- Parameters:
clientRegistrationId- the client registration id to use for building the authorization request- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
fallbackHeaders
Adds hystrix execution exception headers to fallback request. Depends on @{code org.springframework.cloud::spring-cloud-starter-netflix-hystrix} being on the classpath,- Parameters:
config- aFallbackHeadersGatewayFilterFactory.Configwhich provides the header names. If header names arguments are not provided, default values are used.- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
fallbackHeaders
public GatewayFilterSpec fallbackHeaders(Consumer<FallbackHeadersGatewayFilterFactory.Config> configConsumer) Adds hystrix execution exception headers to fallback request. Depends on @{code org.springframework.cloud::spring-cloud-starter-netflix-hystrix} being on the classpath,- Parameters:
configConsumer- aConsumerwhich can be used to set up the names of the headers in the config. If header names arguments are not provided, default values are used.- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-