0

I am using a tomcat server and making POST requests to it. My requests are quite big in size, say up to 10 MB. Is there a way I can increase the max request size?

I am not sending files and it is not a multipart request. I have tried ways that have been discussed earlier but they have been not of much use to me.

Clijsters
  • 4,031
  • 1
  • 27
  • 37
Anurag Mishra
  • 103
  • 1
  • 2
  • 7
  • A 10MB HTTP request that does not include file? What's the request `Content-Type`? It sounds like an XY problem (http://xyproblem.info/) – shaochuancs Sep 01 '17 at 08:56
  • See the https://stackoverflow.com/questions/2947683/httprequest-maximum-allowable-size-in-tomcat – Sudhakar Sep 01 '17 at 08:58
  • I want to send the content of the file in the request but I forcibly don't want it to be a file request. Server is not able to handle such large request. Is there any way I can increase the size of the request that the server is handling? @shaochuancs – Anurag Mishra Sep 01 '17 at 10:17

1 Answers1

1

If I have understood your request, what you need is to increase the default tomcat limits. You then have to open "server.xml" file in conf folder of Tomcat, then search for <Connector> element, and add/edit attribute "maxPostSize". Then restart tomcat.

E.g. this is one I use in a development environment:

<Connector port="8080" protocol="HTTP/1.1"
     URIEncoding="UTF-8"
     compression="on" 
     compressionMinSize="2048"
     connectionTimeout="20000"
     maxPostSize="52428800"
     redirectPort="8443" />

Hoping this can help.

Sampisa
  • 1,487
  • 2
  • 20
  • 28