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

Spring Cloud Gateway Exceeded limit on max bytes to buffer : 262144 Error

Open
#3,863 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I uploaded a large JSON structure (a menu tree) from the frontend. When it reaches the gateway, it throws the following error:

DataBufferLimitException: Exceeded limit on max bytes to buffer : 262144

I’m using Spring 6 and Spring Cloud Gateway 4.

The first approach doesn’t work
spring:
codec:
max-in-memory-size: 10MB
cloud:
gateway:
httpclient:
response-timeout: 30s
connect-timeout: 10000

The second approach doesn’t work
@Bean
public WebFluxConfigurer webFluxConfigurer() {
return new WebFluxConfigurer() {
@Override
public void configureHttpMessageCodecs(ServerCodecConfigurer configurer) {
configurer.defaultCodecs().maxInMemorySize(10 * 1024 * 1024);
}
};
}

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 reproducing the DataBufferLimitException with the large JSON menu tree and compare the two configuration approaches shown in the issue. Inspect Spring Cloud Gateway's codec and request-body handling entry points to determine which setting applies; done means the upload succeeds beyond 262144 bytes with a verified configuration or a documented defect.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.