Spring Boot 413 Request Entity Too Large

1.4k Views Asked by At

How can I resolve the 413 Request Entity Too Large error in a Spring Boot? I am developing a Spring Boot application that uses a Tomcat Embedded server. I have a REST endpoint that accepts a request parameter 'string' and returns a streaming response body. However, when I send a request with a large 'string' value, I get a 413 Request Entity Too Large error.

I have tried setting server.tomcat.max-swallow-size to -1 in my application.yaml, but it still gives me the same error. Are there any other configurations or limits that may be preventing the request from exceeding a certain size?

@GetMapping(value = "/try", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
public ResponseEntity<StreamingResponseBody> try(@RequestParam String prompt)

Any help or guidance on resolving this issue would be greatly appreciated.

0

There are 0 best solutions below