spring-cloud-gateway icon indicating copy to clipboard operation
spring-cloud-gateway copied to clipboard

Create custom predicate based on body

Open RomainWilbert opened this issue 3 months ago • 0 comments

I would like to redirect requests based on some information contained in the body for POST requests with XML content.

CacheRequestBodyFilter is executed after Predicates so ServerWebExchangeUtils.CACHED_REQUEST_BODY_ATTR is null at runtime. I have seen that before there was a ReadBodyPredicate but I guess it was replaced by CacheRequestBodyFilter.

The only alternative I could create a filter to do this and mutate the request to change the URI, but i don't like it.

RomainWilbert avatar Oct 21 '25 16:10 RomainWilbert