Issues and precautions about setting maxPostSize for Tomcat

Issues and precautions about setting maxPostSize for Tomcat

1. Why set maxPostSize?

The tomcat container has a limit on the size of the transmitted data. If a file exceeding this value is uploaded, an error will be reported, making the program unable to be used normally.

2. Setting method

Find /conf/server.xml in the tomcat directory and add the maxPostSize parameter to it

The parameter value "-1" means no size limit. Not setting the maxPostSize parameter means using the default size, which is 2097152 bytes, or 2 megabytes.

3. Notes on setting values

One thing to note is that when there is no limit on the size of transmitted data under different versions of Tomcat, the value of maxPostSize is not the same!

Specific differences:

Before tomcat7.0.63, setting maxPostSize to a value less than or equal to 0 means no limit

In tomcat7.0.63 and later, setting maxPostSize to a value less than 0 indicates no limit

If you set maxPostSize="0" after tomcat7.0.63, the transmitted data will not be obtained.

4. Official Documentation

Attach tomcat changeLog

ps: Tomcat sets maxPostSize, causing Post request to fail

question:

I recently deployed a project using Tomcat version 7.0.82.0. I found that I couldn't log in. I found that the data from the front end could not be passed to the back end.

Troubleshooting: Through the debug log, it was found that the backend did not receive the login data of the front-end user. After checking, it was found that Tomcat added the parameter maxPostSize=0 in server.xml. After deleting this parameter, it was found that the data was received.

analyze:

I searched for maxPostSize=0, which means that the post request has no size limit. After googling for a long time, I found that the meaning of the parameter maxPostSize has changed since apache-tomcat-7.0.63: If the value is set to 0, it means that the maximum POST value is 0. To have no limit on the POST size, you need to set the value to -1. , before this version, set to 0 to indicate no limit on the POST size.

This is the end of this article about the problems and precautions of setting maxPostSize for Tomcat. For more information about setting maxPostSize for Tomcat, please search previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Solve the post parameter restriction problem by setting tomcat through spring boot
  • Solve the problems that need to be paid attention to when configuring Tomcat's maxPostSize attribute
  • Tomcat maxPostSize setting implementation process analysis
  • How to configure the maxPostSize value of built-in Tomcat in Spring Boot

<<:  Vue+echarts realizes stacked bar chart

>>:  Detailed tutorial on installing mysql 8.0.20 on CentOS7.8

Recommend

Solution to the problem that docker nginx cannot be accessed after running

## 1 I'm learning docker deployment recently,...

How to analyze MySQL query performance

Table of contents Slow query basics: optimizing d...

Markup language - CSS layout

Click here to return to the 123WORDPRESS.COM HTML ...

MySQL 8.0.16 installation and configuration tutorial under Windows 10

This article shares with you the graphic tutorial...

CSS box hide/show and then the top layer implementation code

.imgbox{ width: 1200px; height: 612px; margin-rig...

How to deploy DoNetCore to Alibaba Cloud with Nginx

Basic environment configuration Please purchase t...

Some improvements in MySQL 8.0.24 Release Note

Table of contents 1. Connection Management 2. Imp...

Detailed explanation of JavaScript prototype chain

Table of contents 1. Constructors and instances 2...

Detailed explanation of JS ES6 variable destructuring assignment

Table of contents 1. What is deconstruction? 2. A...

Differences between this keyword in NodeJS and browsers

Preface Anyone who has learned JavaScript must be...

How to implement the webpage anti-copying function (with cracking method)

By right-clicking the source file, the following c...

A brief discussion on creating cluster in nodejs

Table of contents cluster Cluster Details Events ...

Solution to the Chinese garbled characters problem in MySQL under Ubuntu

Find the problem I have been learning Django rece...