-AmaxPostSize=-1 not work, cannot post large content
See original GitHub issuemy start command
java -jar ./webapp-runner.jar -AmaxPostSize=-1 ./target/demopostbigcontent-0.0.1-SNAPSHOT.war
jetbrains http client editor
POST 127.0.0.1:8080/greeting/big-content
Content-Type: text/plain
< ./data.json
###
POST 127.0.0.1:8080/greeting/big-content
Content-Type: text/plain
< ./smalldata.json
data.json 2.6 MB smalldata.json 3k
my code, Spring Boot framework
Greeting.java
public class Greeting {
private final long id;
private final String content;
public Greeting(long id, String content) {
this.id = id;
this.content = content;
}
public long getId() {
return id;
}
public String getContent() {
return content;
}
}
GreetingController.java
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.concurrent.atomic.AtomicLong;
@RestController
public class GreetingController {
private static final String template = "Hello, %s!";
private final AtomicLong counter = new AtomicLong();
@RequestMapping("/greeting/big-content")
public Greeting greetingBigContent(@RequestBody String payload) {
return new Greeting(counter.incrementAndGet(),
payload);
}
}
submit data.json failed
submit smalldata.json success
I tried adjusting many tomcat parameters but none worked, for example
java -jar ./webapp-runner.jar -AmaxPostSize=-1 -AmaxSwallowSize=-1 -AconnectionTimeout=100000 -AmaxSavePostSize=-1 -AmaxParameterCount=-1 ./target/demopostbigcontent-0.0.1-SNAPSHOT.war
How to solve this problem? please help me, thanks
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
Increase HTTP Post maxPostSize in Spring Boot
If you are using using x-www-form-urlencoded mediatype in your POST requests (as I do), the multipart property of spring-boot does not work.
Read more >How You Can Fix The Biggest Problem With React File Upload
This step is crucial in view of uploading files because you must set the content type to multipart/form-data, or else it won't run...
Read more >Cannot Post Requisition to Job Boards - My Oracle Support
The following things may be evident or represent what the user is trying to accomplish: Job board posting not working; Cannot post to...
Read more >Can't Upload Videos to Facebook? Try This Fix - Camberlion
If your Facebook video is not uploading, there is a good chance that either your video is too long, is larger than the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
maxPostSize
is only used when parsingapplication/x-www-form-urlencoded
payloads. Since you explicitly send aContent-Type: text/plain
that restriction has no effect. Omitting-H 'Content-Type: text/plain'
in your example returns a400
(Bad Request) as expected for payloads > 2MiB.Hello! Since this is an old issue and many things have changed since it was opened I will close it for now. Feel absolutely free to re-open it if it is still relevant so we can work on it! 😃