spring-cloud / spring-cloud/spring-cloud-gateway

Conditional Caching in ServerWebExchangeUtils.cacheRequestBody

Open
#2,259 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

waiting for votes
Dominant language
Java
Stars
4.9k
Forks
3.5k
Avg merge
20h 57m
Merged PRs (30d)
8

Description

For some reasons we do not limit the size of request body size.
And as a usual practise we enable RetryFilter on routes.
And here comes the problem.
When we enable the RetryFilter, the RetryFilter also enable request body caching.
Thus when the clients post a large request body, the server's memory is easilly overflowed.
However, currently, we cannot config the caching strategeis in RetryFilter/AdaptCachedBodyGlobalFilter/ServerWebExchangeUtils.
We cannot even override those classes.
This is a fatal problem and we are still figuring out a workaround...

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing request-body caching through RetryFilter, AdaptCachedBodyGlobalFilter, and ServerWebExchangeUtils.cacheRequestBody. Clarify the desired configurable caching strategy and limits before implementation; done should prevent large retry-triggered request bodies from exhausting server memory.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring, spring-boot
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.