question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

-AmaxPostSize=-1 not work, cannot post large content

See original GitHub issue

my 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

image

submit smalldata.json success

image

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:closed
  • Created 4 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
Malaxcommented, Jan 10, 2020

Why can I upload successfully without any error ?

maxPostSize is only used when parsing application/x-www-form-urlencoded payloads. Since you explicitly send a Content-Type: text/plain that restriction has no effect. Omitting -H 'Content-Type: text/plain' in your example returns a 400 (Bad Request) as expected for payloads > 2MiB.

0reactions
Malaxcommented, Nov 11, 2022

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! 😃

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found